ImageMagick -monitor command for animated gif resizing - imagemagick

Using ubuntu:
convert /home/cms/img2.gif -monitor -resize 150x /home/cms/result.gif
I'm using ImageMagick for resizing/cropping purposes and want to create progress bar for resizing procedure. Everything is ok for jpeg images, but when i'm trying to resize large animated gif it's creating TONS of various information about % complete.
I'm confused. I have tried to follow overall progress, by reading 200mb+ log...
Log says that resizing is 100%, but after that, there is about 200mb others operations like Dither, Reduce, Saving etc...
Is there a easier way to follow progress of animated gifs resizing?
What is the strict order of operations ImageMagick is doing, when processing animated gif?
Thanks.

Related

Overlaying multiple PNG images of different sizes on a canvas using ImageMagick

I want to overlay multiple PNG images of different sizes on a transparent canvas using ImageMagick. First I create a transparent canvas of some fixed size, say like
convert -size 1500x1000 canvas:transparent PNG32:canvas.png
Then I loop over my images in order to add each image to the canvas
convert canvas.png nthimage.png -gravity Center -geometry xResxYres+xcoord+ycoord -composite canvas.png
This works fine, but I may overlay as many as 10 pictures and I do this for thousands of n-tuples of images, so a faster solution would be appreciated. So my question: Can I also do this in one step instead of creating the canvas first and then adding a single image at a time?
Edit: I use ImageMagick 7.0.11-13 on macOS 10.15.7. I run ImageMagick from within a python script, so a file containing a list of input files can be generated if needed. For concreteness, say my input files are file_1.png up to file_n.png with sizes A1xB1 up to AnxBn and should be placed at coordinates +X1+Y1 up to +Xn+Yn with respect to the center of the canvas and the output file is output.png and should have size 1500x1000.
I really wouldn't recommend shelling out subprocesses from Python to call ImageMagick thousands of times. You'll just end up including too much process creation overhead per image, which is pointless if you are already running Python which can do the image processing "in house".
I would suggest you use PIL, or OpenCV directly from Python, and as your Mac is certainly multi-core, I would suggest you use multi-processing too since the task of doing thousands of images is trivially parallelisable.
As you haven't really given any indication of what your tuples actually look like, nor how to determine the output filename, I can only point you to methods 7 & 8 in this answer.
Your processing function for each image will want to create a new transparent image then open and paste other images with:
from PIL import Image
canvas = Image.new('RGBA', SOMETHING)
for overlay in overlays:
im = Image.open(overlay)
canvas.paste(im, (SOMEWHERE))
canvas.save(something)
Documentation here.

Imagemagick convert: -strip everything *except* the colorprofile (color colour profile)

I'm using Imagemagick to resize large images (jpgs, pngs and tiffs) and convert to jpg for use in the browser.
I use -strip to remove all unnecessary information and keep my images nice and clean.
But in the process I'm removing colour profiles. This is really noticeable when it's an AdobeRGB 1998 image as it becomes really flat.
Is there a way to strip everything unnecessary except for the colour profile? Lots of people have asked this on forums before but I've never seen a solid answer.
OP here, answering my own question for anyone who needs it in the future:
I've swapped -resize for -thumbnail and have removed -strip. All seems good.
-thumbnail strips the exif data, but leaves the colour profile intact.
It sounds like it's just for making small images, but you specify dimensions in exactly the same way as with -resize so it's appropriate for any size of image.
I've had this live for about three weeks without problems so far, so happy to say this is a solid solution.

How to get a gold foil look using ImageMagick

My requirement is to convert a image with a transparent background to look like gold foil (the way it’s printed on leather etc.)
I've been using ImageMagick and am getting excellent results with certain kind of PNGs but not with others.
The Image Magick command I am using is:
composite foil.png tmp.png logog.png outputg.png
foil.png is just a gold foil image
tmp.png is a plain/empty transparent background png
logog.png is the logo with transparent background
outputg.png is the output (this is what I need)
However, this kind of result does not occur in most other images with transparent backgrounds.
Ex.
logom.png gives outputm.png which is all gold
logos.png gives outputs.png which is all gold and all wrong
Download all files as zip from here from here http://sdrv.ms/1h7QW4A or view from http://s.imgur.com/a/ExLRE
I checked the encodings of these all PNGs and they are all the same. What is wrong with logom and logos that the outputs are not as they should turn out to be?
If I am approaching the solution from the wrong direction, please suggest alternatives.

how to deal with big picture in UIScrollView

I have a big picture to show in UIScrollView.It's 28.1 MB.And it often crash the app.Is there some methods to deal with it so that app won't crash?
Here you go buddy,
Convert Large Image to tiles
Displaying tiled images in UIScrollview
Tiled Images in UIScrollView
If it's a static PNG image, run it through ImageAlpha and ImageOptim (Google these). You might be able to get it down by well over 50%. Bundle the resulting image with your app instead.
Note that ImageOptim is lossless whereas ImageAlpha is lossy. You can use them in conjunction.
Split up the image and load the pieces only when necessary.

How to merge a jpg with a gif without lossing the animation of gif file?

I am trying to merge a splash screen image which is in jpg format with an ajaxloader which is in gif format.
I tried the following command using ImageMagik:
convert -delay 50 splashimage.jpg ajaxloader.gif final.gif
This command does merge the gif file with the jpg image but the loader appear at the top-left corner.
I was wondering if there is an option available to place it at a specfic (x,y) point on the jpg image?
If anybody has had done a similar thing or has an idea as to how a similar thing can be achieved, please guide me through.
Thanks.
Why would you want to do this? You'd be turning a nice 24bit JPG into a crappy quality single frame on an 8bit gif. You could just use some CSS tricks to overlay the loader .gif on top of the .jpg on a webpage, which would not sacrifice any image quality to achieve the same effect.
I solved the problem by designing individual frames of images with the desired location of my text and merged them using Imagemagik.

Resources