Problem using convert

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Problem using convert

Post by fmw42 »

there is no such image format that I know of with the suffix .tmp

If you want to create a temporary image, there are multiple ways to do so using other IM formats such as miff, mpc and mpr

see http://www.imagemagick.org/Usage/files/
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Problem using convert

Post by anthony »

If you really need a .tmp suffix, you will need to specify the image format as a prefix

Code: Select all

   convert .... miff:C:\gallery2_data\tmp\img1732.tmp
The IM default otherwise would be to use the format that was read, if posible, otherwise it will save as MIFF (the internal Magick Image File Format).

What you should use format depends on how you plan to use the image, as every image format as its pro's and con's. See IM Examples, File Handling (for the special MIFF and MPC formats), and Common File Formats (for GIF, PNG, and JPEG etc)

Also it is better to read the image BEFORE operating on it (using -geometry).

Finally -geometry is a very special operator in IM and only really of use in Image Composition, to set the images composition offset. For image resizing it is recommended you use -resize, or -thumbnail.

For more information about thing, see IM Examples (see signature). You can use the 'Reference' page to find information about specific options quickly.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
virshu

Re: Problem using convert

Post by virshu »

I think the anthony's advise is somewhat misdirected. The first poster is using Gallery2 (and not IM directly) that generates the command that is described there:

Code: Select all

convert.exe  -size 200x200  -geometry  200x200 test.gif imgE5B7.tmp
This command works perfectly fine in IM 6.3.5 but is producing an error IM 6.4.2. She probably knows that there is no image format with suffix .tmp; and if she doesn't - she doesn't care. She wants to use Gallery2 that instructed her to download ImageMagick, and she followed instructions, and she got a problem.

One (probably pointless) question is, what was the reason to break backward compatibility? And corollary to that - is there any place where such things are documented. Gallery relies on IM quite heavily, and it would be most unfortunate if users find such problems through trial and error...

Another, more practical, question - is it possible to post old version for download. This way, until this issue is resolved, Gallery developers could post a note instructing the users to download version 6.3, and not 6.4, which is incompatible with Gallery
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Problem using convert

Post by fmw42 »

I know nothing about Gallery. But it would have been prudent for the Gallery people to be on top of IM if they are recommending its use.

With regard to command line syntax, this is explained in detail at http://www.imagemagick.org/Usage/basics/#cmdline
virshu

Re: Problem using convert

Post by virshu »

fmw42 wrote:I know nothing about Gallery. But it would have been prudent for the Gallery people to be on top of IM if they are recommending its use.
And we are. There is already a bug open to fix it.
fmw42 wrote:With regard to command line syntax, this is explained in detail at http://www.imagemagick.org/Usage/basics/#cmdline
I didn't find anything in this link that makes the current syntax

Code: Select all

convert.exe  -size 200x200  -geometry  200x200 test.gif imgE5B7.tmp
illegal. Not to mention that it worked fine in 6.3.

That said, we don't need to agree whether it's Gallery's invocation bug, or IM implementation bug. Let's say it's both. What I am asking is to make 6.3 available, so that Gallery users can download the IM version that is compatible, namely 6.3

Thanks in advance
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Problem using convert

Post by anthony »

Older versions are available from the source forge site.
http://sourceforge.net/project/showfile ... p_id=24099
Go to the link about 'older releases'.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Problem using convert

Post by fmw42 »

Did you see the section: http://www.imagemagick.org/Usage/basics/#legacy

That has the only explanation of legacy style vs IM 6 style convert that I am aware of and there are warnings that things may not work properly. I do not know whether your specific command falls into that category or not or if something else has changed in IM since 6.3.

As to making IM 6.3 available, I have to leave that to the folks at IM.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Problem using convert

Post by anthony »

And IM v7 (when that project starts) may not support legacy style, as it currently requires IM to parse the command line TWICE, and prevents the future creation of 'convert' scripts, where convert options are read from a file, rather than the command line.

Basically legacy style is a current 'limitation' to IM's development.

However legacy style is NOT the problem you are having.


The original problem is that you do not define what image format '.tmp' is meant to be, but are assuming that it is the same as the input image format.

Presumably something had changed that causes '.tmp' suffix to override the 'keep old format' handling that you are relying on (and should NOT be relying on).

An alternative 'fix' is to create an personal output 'delegate' that tells IM what to do to create a 'tmp' image file format. But this should be personal (for your specific case) and not general.

here is an untested ".magick/delegates.xml" file.

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<delegatemap>
  <delegate decode=gif encode="tmp" command='mv "%i" "%o"'/>
</delegatemap>
With this file in place Im now understands how to create a GIF 'tmp' files, and your original command will work!

Code: Select all

   convert  -size 200x200  -geometry 200x200 image.gif image.tmp
Do not add the delegate to the 'system' delegates.xml file, or it will 'disappear' when your IM is upgraded.


The above 'solution' has been added to the updated 'delegates' section of IM examples, and will appear in a day to two.
http://www.imagemagick.org/Usage/files/#delegates
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
virshu

Re: Problem using convert

Post by virshu »

Folks, thanks all for the quick replies.
  • I understand the point about legacy format vs. deprecated in v.6 vs removed in v.7. However, it is not relevant to the issue at hand. the non-legacy format

    Code: Select all

    convert.exe test.gif -size 200x200 -geometry 200x200 test3.tmp
    has the same problem (works in 6.3, doesn't work in 6.4)
  • We were pointing to IM download page; not to SourceForge. We will make a note about the incompatibility and recommend to use 6.3 in the meantime
  • We will change the generated command line before the next release. Fortunately, the problem only exhibits in Windows. PHP tempnam() function generates test3.tmp on Windows, but temp3 (without any extension) on Linux, and IM doesn't have a problem with

    Code: Select all

    convert test.gif -size 200x200 -geometry 200x200 test3
    (at least, not now).
If you find other incompatibilities with previous versions, I would strongly encourage you to publicize them more conspicuously.
el_supremo
Posts: 1015
Joined: 2005-03-21T21:16:57-07:00

Re: Problem using convert

Post by el_supremo »

virshu wrote:

Code: Select all

convert.exe  -size 200x200  -geometry  200x200 test.gif imgE5B7.tmp
This command works perfectly fine in IM 6.3.5 but is producing an error IM 6.4.2.
Do you have an example of a .tmp file produced like that on 6.3.5? If so, could you run the command:

Code: Select all

identify example.tmp
and let us know what it outputs?

Pete
virshu

Re: Problem using convert

Post by virshu »

The IM 6.4 - compatible version will be released as part of Gallery 2.3 RC-2 (due in a week or so), or you can get it from nightly build tomorrow
Post Reply