Hi,
I'm using ImageMagick for verifying functionalities of my application. I wrote scripts which will verify the behaviour using Compare command utilities and it is working fine for me.
I am saving image when a comparison failed. So need to analyze the current failed image against the precaptured image to know, what went wrong during failure. Initially I composed a difference between precaptured and current failed image, but when those two are entirely different screens in application, it is very difficult for me to interpret the diff image.
precaptured :
current application image :
While going through IM tutorials, I read that we have options to create GIF images. So planning to save a GIF of image during the image comparison failure case as below
convert -delay 30 -loop 10 two.jpg one.jpg two.jpg out.gif
out.gif :
Here as per tutorial gave loop as 10 instead of 0 for easy analysis and also set first and last frame as two.jpg, because we can't predict the end frame during loop shutdown.
Please correct me, if above steps are wrong.
Coming to my issue,
I want to add some additional text or small image to correctly identify the two frames(precaptured and currently failed )images as below
precaptured with 'P' text on left top corner :
current failed image with 'E' text on left top corner:
How can I add some text or small images for identifying these frames, before creating the GIF ? Please share commands for doing this job. Also share inputs regarding performance of this operation - whether a costly one or not ?
Doubt regarding GIF creation from set of images
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Doubt regarding GIF creation from set of images
You could use "-annotate" to place text. For example (Windows syntax):
Usng jpeg for the screen capture is bad, as it is lossy (it changes pixel values). Use a lossless format, such as png, if you can.
Code: Select all
%IM%convert ^
-delay 30 ^
-loop 10 ^
( one.jpg -gravity NorthWest -fill Red -annotate 0 P ) ^
( two.jpg -gravity NorthWest -fill Red -annotate 0 E ) ^
p.gif
snibgo's IM pages: im.snibgo.com
Re: Doubt regarding GIF creation from set of images
Thanks Snibgo, it worked !
Regarding JPEG file format, actually I'm snapping the images from a Motion JPEG video and does the comparison. So is there a big difference in pixel values, while saving images as PNG and JPEG from a Motion JPEG snapshot ? Please confirm.
Regarding JPEG file format, actually I'm snapping the images from a Motion JPEG video and does the comparison. So is there a big difference in pixel values, while saving images as PNG and JPEG from a Motion JPEG snapshot ? Please confirm.
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Doubt regarding GIF creation from set of images
It depends on the movie compression. You should try it to find out. The movie compression has (almost certainly) changed pixels, and saving a frame as jpeg probably won't make it much worse.So is there a big difference in pixel values, while saving images as PNG and JPEG from a Motion JPEG snapshot ?
snibgo's IM pages: im.snibgo.com
Re: Doubt regarding GIF creation from set of images
Hi All,
One more doubt in the GIF creating scenario.
I've annotated 'expected' and 'actual' images with text using following command
Then created the GIF by placing first and last frame as same to get a consistent stop frame during loop stop.
Now my issue is about the GIF size. Since there are three frames, I expect that the GIF size is linear to number of frames. But If I have the actual and expected images of size approximately 50KB then the resultant GIF size is almost 500KB. I am expecting around 150KB, since there are three frames specified.
Can some one ensure that this behavior expected OR not in IM 6.8.6-8 ? Also is there any way to minimize the size of the GIF without degrading quality of the resultant GIF?
One more doubt in the GIF creating scenario.
I've annotated 'expected' and 'actual' images with text using following command
Code: Select all
convert one.jpg -gravity NorthWest -fill Red -pointsize 20 -annotate 0 Actual one-annotated.jpg
Code: Select all
convert two.jpg -gravity NorthWest -fill Red -pointsize 20 -annotate 0 Expected two-annotated.jpg
Code: Select all
convert -delay 30 -loop 10 one-annotated.jpg two-annotated.jpg one-annotated.jpg out-with-annotation.gif
Can some one ensure that this behavior expected OR not in IM 6.8.6-8 ? Also is there any way to minimize the size of the GIF without degrading quality of the resultant GIF?
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Doubt regarding GIF creation from set of images
Are you comparing three GIFs with one animated GIF, or three JPGs with one animated GIF?
GIF and JPG compressions will be different, of course.
GIF and JPG compressions will be different, of course.
snibgo's IM pages: im.snibgo.com
Re: Doubt regarding GIF creation from set of images
Three JPGs against the one animated GIF.
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Doubt regarding GIF creation from set of images
Well, that's the issue. You will probably find that the gif with 3 frames is about the same as the total of the 3 separate gifs. It may be smaller with "-layers optimize" (or one of the others, see http://www.imagemagick.org/script/comma ... php#layers) provided enough pixels are constant from one frame to the next.
snibgo's IM pages: im.snibgo.com