PNG Strips

DSP, Plugin and Host development discussion.
RELATED
PRODUCTS

Post

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

Post

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/

Post

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.

Post

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

Post

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: )

Post

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.

Post

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.

Post

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

Post

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

Thank you all, guys.

Cheers,
Luca

Post

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.

Post

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

Post

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

Post

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

Post

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

Post

Thanks!

Post Reply

Return to “DSP and Plugin Development”