auto creating output files, not obeying command line?

Post any defects you find in the released or beta versions of the ImageMagick software here. Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? Post it here.
Post Reply
jondaley

auto creating output files, not obeying command line?

Post by jondaley »

I don't know if this has already been reported (or fixed in a more current version) I am on 6.2.4 from Debian "testing".

If I take a gif (animated, though I expect that doesn't matter) named 1.gif
and then run "convert 1.gif 2.gif.jpg" I would expect to get 2.gif.jpg as the output file, however, I get 2.jpg instead, which breaks the script (album) that calls convert.

I tried using the -write option, but the same rewriting logic is applied there. If that is a desired feature for some people, it would be nice to have an option that says "be dumb, and do exactly what I say, even if you think it doesn't make sense".
jondaley

Re: auto creating output files, not obeying command line?

Post by jondaley »

Perhaps this will be more helpful:

Code: Select all

>convert 2007-12-24_01_jonathan_flying_advent_calendar.gif 1.gif.jpg
1.jpg

>convert 2007-12-24_01_jonathan_flying_advent_calendar.gif 1.gif.qwe.jpg
1.gif.jpg

>convert 2007-12-24_01_jonathan_flying_advent_calendar.gif 1.234.gif.qwe.jpg
1.234.gif.jpg

>convert 2007-12-24_01_jonathan_flying_advent_calendar.gif 1.234.qwe.jpg
1.234.jpg

>convert 2007-12-24_02_jonathan_with_candles.jpg  1.234.qwe.jpg
1.234.qwe.jpg

>convert 2007-12-24_02_jonathan_with_candles.jpg 1.234.qwe.gif
1.234.qwe.gif
The last two do what I'd expect, the rest don't. Is this behavior intended?
jondaley

Re: auto creating output files, not obeying command line?

Post by jondaley »

From a friend:


I've figured it out.

This is only for animated gifs.

The problem is how it deals with multiple frames.

Anyways, here's what happens:

% convert anim.gif anim.jpg
Creates: anim-0.jpg, anim-1.jpg, ...

% convert anim.gif[0] anim.jpg
Creates: anim.jpg

% convert anim.file.gif[0] anim.file.jpg
Creates: anim.file.jpg

% convert anim.file.gif anim.file.jpg
Creates: anim.jpg

Oops!

It should be:

% convert anim.file.gif anim.file.jpg
Creates: anim.file-0.jpg, anim.file-1.jpg, etc..

That last one is a bug. I'd file it with ImageMagick.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: auto creating output files, not obeying command line?

Post by anthony »

That is NOT A BUG It is a feature!!!!!

JPG can not save mulitple images into a single filename, so it adds a number before the suffix (old versions of IM added the number after the suffix which broke some file managers, especially on windows).

You can control the placement of the number by adding a %d to the given output filename (this also forces a number to be used in the output filename.
or insure that the number is 3 (or other) digits with leading zeros by using %03d instead
You can control the starting number of the out using -scene
You can delete extra images by using -delete 2--1
or just not read in the extra images by using a image read modifier such as input.gif'[0]'

For more see IM Examples, Files, Multi-image sequences
http://imagemagick.org/Usage/files/#write_seq
For reading see File Handling, read Modifiers
http://imagemagick.org/Usage/files/#read_mods
also Image Sequences, Deleting...
http://imagemagick.org/Usage/basics/#delete

Basically READ IM Examples!!!!
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
jondaley

Re: auto creating output files, not obeying command line?

Post by jondaley »

Just to make sure, you are saying this is the desired behavior:


% convert anim.file.gif anim.file.jpg
Creates: anim.jpg
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: auto creating output files, not obeying command line?

Post by anthony »

It should create anim.file.jpg
and on my system it does for a single image GIF

Code: Select all

convert logo: anim.file.gif
convert anim.file.gif anim.file.jpg
ls anim*
produces
anim.file.gif anim.file.jpg
for a multi-image GIF

Code: Select all

rm anim*
convert rose: netscape: granite: anim.file.gif
convert anim.file.gif anim.file.jpg
ls anim*
produces
anim.file-0.jpg anim.file-1.jpg anim.file-2.jpg anim.file.gif
Which is correct. JPEG cans save multiple image image file, so it creates three numbered files instead.

I am using the latest IM, build on my system from the source SRPM. Version 6.3.7-9
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
jondaley

Re: auto creating output files, not obeying command line?

Post by jondaley »

I guess it will be hard to fix if you can't reproduce it. (or maybe it has already been fixed...)

We can reproduce it on:

Ubuntu:
Version: ImageMagick 6.2.4 10/02/07 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2005 ImageMagick Studio LLC

Debian 'testing':
Version: ImageMagick 6.2.4 09/30/07 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2005 ImageMagick Studio LLC
Post Reply