PNG Strips

DSP, Plug-in and Host development discussion.
User avatar
Audiority
KVRian
769 posts since 15 Nov, 2005 from Italy

Post Sat Mar 03, 2018 9:43 am

Hey guys,
what are you using to combine several png frames in a vertical strip?
So far I used ImageMagick, but I just found out that it's slightly changing the png colors when I combine them... so I'm looking for an alternavie, possibly on Mac.

Cheers,
Luca
Audiority
Need a Kontakt scripter? Contact me.

User avatar
Totolitoto
KVRAF
1868 posts since 7 Jan, 2004 from Earth

Re: PNG Strips

Post Sat Mar 03, 2018 9:48 am

This is pretty amazing, and online
You can save the page too, the scipt will still work when offline!
http://www.cssportal.com/css-sprite-generator/

User avatar
Audiority
KVRian
769 posts since 15 Nov, 2005 from Italy

Re: PNG Strips

Post Sat Mar 03, 2018 9:53 am

Thanks, but unfortunately that's not for me since my strips are made of over 100 files and sometimes each frame can be pretty big.
Audiority
Need a Kontakt scripter? Contact me.

User avatar
Totolitoto
KVRAF
1868 posts since 7 Jan, 2004 from Earth

Re: PNG Strips

Post Sat Mar 03, 2018 9:56 am

I mabe knobs with 128 frames without a problem
Did you try it?

mystran
KVRAF
5032 posts since 12 Feb, 2006 from Helsinki, Finland

Re: PNG Strips

Post Sat Mar 03, 2018 10:32 am

Audiority wrote: what are you using to combine several png frames in a vertical strip?
I've used a Gimp script in the past, there's a few on the web. To use these you usually use "open as layers" in Gimp to load all the files as layers and then run a script that merges them into a single image (whether strip or grid or whatever).
So far I used ImageMagick, but I just found out that it's slightly changing the png colors when I combine them... so I'm looking for an alternavie, possibly on Mac.
Maybe it's a colorspace thing where IM is trying to be helpful and output sRGB and the input images have colorspace metadata for something else so it ends up converting? You could try telling IM to just assume the inputs are sRGB and see if that helps?

(don't ask me how to do it, but judging by the manual it seems that it should be possible :help: )
If you'd like Signaldust to return, please ask Katinka Tuisku to resign.

User avatar
Audiority
KVRian
769 posts since 15 Nov, 2005 from Italy

Re: PNG Strips

Post Sat Mar 03, 2018 10:36 am

Thanks, guys. I checked the colorspace and it's sRGB for all frames. I already tried forcing IM to use the same colorspace for all the files, but the result it's still wrong.
Audiority
Need a Kontakt scripter? Contact me.

User avatar
Audiority
KVRian
769 posts since 15 Nov, 2005 from Italy

Re: PNG Strips

Post Sat Mar 03, 2018 4:31 pm

Totolitoto wrote:I mabe knobs with 128 frames without a problem
Did you try it?
I noticed the process is client side, so I tried and I found something.. if I join just a couple of frames, the color doesn't change. Instead, if I join ALL my frames, I get the same error. I never experienced something like that before.
Audiority
Need a Kontakt scripter? Contact me.

Ivan_C
KVRian
1073 posts since 11 Aug, 2004 from Breuillet, France

Re: PNG Strips

Post Sat Mar 03, 2018 11:36 pm

Do yourself a favor, spend 1 day coding an application that does all the things you need, it's quite simple with JUCE

User avatar
Audiority
KVRian
769 posts since 15 Nov, 2005 from Italy

Re: PNG Strips

Post Sun Mar 04, 2018 9:21 am

Yes, Ivan. Looks like that's the best option to me.

Thank you all, guys.

Cheers,
Luca
Audiority
Need a Kontakt scripter? Contact me.

User avatar
EvilDragon
KVRAF
17159 posts since 7 Jan, 2009 from Croatia

Re: PNG Strips

Post Sun Mar 04, 2018 9:28 am

JKnobman can do it. Or a python script (provided you have PIL installed - if you install Anaconda distro of Python, you will have it available along with it). Example:

Code: Select all

from PIL import Image

filename = 'frame'
outfile = 'output.png'
num_frames = 100
step = 1

images = [Image.open(filename + '%d.png' % i) for i in range(1,num_frames+1,step)]
width, height = images[0].size
big_image = Image.new(images[0].mode, (width, height * len(images)))
for i, img in enumerate(images):
    big_image.paste(img, (0, height * i))
big_image.save(outfile)
Above script expects input images named "frame1.png", "frame2.png" etc., up to num_frames.

AnX
KVRAF
3385 posts since 17 Nov, 2015

Re: PNG Strips

Post Sun Mar 04, 2018 9:39 am

viewtopic.php?t=100816

Also Tobybear did some graphic utils here

https://www.tobybear.de/files.html

I think they are win only, but def has an image stitcher/unstitcher

earlevel
KVRist
477 posts since 4 Apr, 2010

Re: PNG Strips

Post Sun Mar 18, 2018 9:43 am

It's trivial in python. Basically, you read images as two dimensional arrays, append to a composite "film strip" array, save it as an image. See a post of mine here: viewtopic.php?f=33&t=366384&p=6194549&h ... e#p6194549

But to recap, my actual python script is a more complicated, because I needed it to assemble ancient PICT resources and convert associated mask files to alpha, but this is the gist of it; note I'm using a numerical naming convention (100.png, 101.png...) and the calling parameters have the starting number and how many, but you can see the hard work is just a read and concatenate of each, then save the result:

Code: Select all

   from scipy import misc
   import numpy

   for idx in range(0, numFrames):
      tempImage = misc.imread(inFileDir + "/" + str(baseNum + idx) + ".png")
      if (idx == 0):
         newImage = tempImage
      else:
         newImage = numpy.concatenate((newImage, tempImage))

   misc.imsave(outFilePath, newImage)
My audio DSP blog: earlevel.com

Miles1981
KVRian
1366 posts since 26 Apr, 2004 from UK

Re: PNG Strips

Post Mon Mar 19, 2018 2:25 pm

EvilDragon wrote:JKnobman can do it. Or a python script (provided you have PIL installed - if you install Anaconda distro of Python, you will have it available along with it).
Also what I'm using. Dead simple. And then you can use Python for DSP validation as well, no reason no to use it :D

User avatar
Branis
KVRian
1301 posts since 21 May, 2004 from Serbia

Re: PNG Strips

Post Mon Mar 19, 2018 2:33 pm

There's PNG Stitch, it's made for that one purpose

User avatar
Audiority
KVRian
769 posts since 15 Nov, 2005 from Italy

Re: PNG Strips

Post Thu Mar 22, 2018 12:56 am

Thanks!
Audiority
Need a Kontakt scripter? Contact me.

Return to “DSP and Plug-in Development”