Page 1 of 1

Resizing multiple dimensions, multiple formats

Posted: 2016-09-25T16:35:15-07:00
by bibby
Hi guys,

I have a bit of a plea to help me improve the performance of a command.

What I am trying to do is this:
Given a source image, resize it to various sizes, and for each size save it in a few different formats.

Initially I did this by the means of some nested loops in PHP, having a different convert command for each size/format. This was quite slow.

Currently, my command looks like this:

Code: Select all

convert 'test.jpg' \
\( +clone -resize 3000x \
    \( +clone -quality 85 -write 'test 3000.webp' +delete \) \
    \( +clone -quality 85 -write '/test 3000.jpeg' +delete \) \
    \( +clone -quality 85 -write 'test 3000.png' +delete \) \
    +delete \) \
\( +clone -resize 2000x \
    \( +clone -quality 85 -write 'test 2000.webp' +delete \) \
    \( +clone -quality 85 -write 'test 2000.jpeg' +delete \) \
    \( +clone -quality 85 -write 'test 2000.png' +delete \) \
    +delete \) \
\( +clone -resize 1000x \
    \( +clone -quality 85 -write 'test 1000.webp' +delete \) \
    \( +clone -quality 85 -write 'test 1000.jpeg' +delete \) \
    \( +clone -quality 85 -write 'test 1000.png' +delete \) \
    +delete \) \
\( +clone -resize 500x \
    \( +clone -quality 85 -write 'test 500.webp' +delete \) \
    \( +clone -quality 85 -write 'test 500.jpeg' +delete \) \
    \( +clone -quality 85 -write 'test 500.png' +delete \) \
    +delete \) \
\( +clone -resize 200x \
    \( +clone -quality 85 -write 'test 200.webp' +delete \) \
    \( +clone -quality 85 -write 'test 200.jpeg' +delete \) \
    \( +clone -quality 85 -write 'test 200.png' +delete \) \
    +delete \) \
\( +clone -resize 100x \
    \( +clone -quality 85 -write 'test 100.webp' +delete \) \
    \( +clone -quality 85 -write 'test 100.jpeg' +delete \) \
    \( +clone -quality 85 -write 'test 100.png' +delete \) \
    +delete \) \
null:
(I have tried to re-format the above in order to make it more readable)

The general idea is to open the image, clone it to resize, then clone the resized version for each desired format, and repeat.

I tried the -monitor option, the output of this looks rather like this:

Code: Select all

Load/Image//test.jpg]: 2591 of 2592, 100% complete
Resize/Image//test.jpg]: 5007 of 5008, 100% complete
Load/Image//tmp[magick-17321HoHBm5dIzJAP]: 2007 of 2008, 100% complete
Resize/Image//test.jpg]: 3338 of 3339, 100% complete
Load/Image//tmp[magick-17321nLYjY8YlK6jY]: 1338 of 1339, 100% complete
Resize/Image//test.jpg]: 1668 of 1669, 100% complete
Load/Image//tmp[magick-173218bgbxFLEHEz7]: 668 of 669, 100% complete
Resize/Image//test.jpg]: 834 of 835, 100% complete
Load/Image//tmp[magick-17321I8FOKQF9yESr]: 334 of 335, 100% complete
Resize/Image//test.jpg]: 333 of 334, 100% complete
Load/Image//tmp[magick-17321uvkNSbuf2bk8]: 133 of 134, 100% complete
Resize/Image//test.jpg]: 166 of 167, 100% complete
Load/Image//tmp[magick-17321v6F4VLRZkvsY]: 66 of 67, 100% complete
(please note that I have been fiddling around with the command for a while, this may be output from an earlier attempt, but the general form is the same)

It does seem to spend a long time on lines beginning with "Load/Image//tmp" which I found surprising, to me this seems to be loading the intermediate images from a temp file, where I would expect it to be held in RAM.

I added "-limit memory 4000MiB" to the command thinking it might be doing the equivalent of paging out the data, but this had no effect and I struggle to believe that the uncompressed data takes anywhere near 4 gigs of RAM.

I have tried messing about with mpr:, but this made no difference either.

At the moment I am rather at a loss as to what to try next, and I would appreciate any pointers that folk might be able to give me.

Here are some details about my setup:

Code: Select all

$ uname -a
Linux foo-VirtualBox 3.19.0-32-generic #37~14.04.1-Ubuntu SMP Thu Oct 22 09:41:40 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux

Code: Select all

cat /proc/meminfo
MemTotal:        3112044 kB
MemFree:         1257256 kB
MemAvailable:    2416080 kB

Code: Select all

$ convert -version
Version: ImageMagick 6.9.3-3 Q16 x86_64 2016-02-06 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2016 ImageMagick Studio LLC
License: http://www.imagemagick.org/script/license.php
Features: Cipher DPC HDRI OpenMP 
Delegates (built-in): freetype jbig jng jpeg lcms lzma png tiff zlib
My test.jpg image is some random JPEG around 3000x3000 pixels, ~3MiB and the above command takes just over 30 seconds.

Re: Resizing multiple dimensions, multiple formats

Posted: 2016-09-25T16:57:40-07:00
by snibgo
Chunks like this:

Code: Select all

\(+clone -quality 85 -write 'test 3000.webp' +delete \) \
\( +clone -quality 85 -write '/test 3000.jpeg' +delete \) \
\( +clone -quality 85 -write 'test 3000.png' +delete \) \
... can be replaced by:

Code: Select all

-quality 85 +write 'test 3000.webp'  +write '/test 3000.jpeg' -write 'test 3000.png' +delete \
Note the first two writes are "+", not "-". (I always use "+", but for best performance, when you don't need "+", "-" is quicker.)
MemAvailable: 2416080 kB
So you have only 2.4 GB available. For v6 Q16, 3000x3000 pixels should take only about 72 MB, so plenty of room. True, the first resize will take the same again, and the same again for the "+write"..

But if the image is 3000x3000, why does a line say:
5007 of 5008
5000x5000 would take 200 MB, times three is 600 MB, so creeping up to your 2.4 GB.

Re: Resizing multiple dimensions, multiple formats

Posted: 2016-09-25T23:36:58-07:00
by Bonzo
But if the image is 3000x3000, why does a line say:5007 of 5008
I assume it is image number 5007 out of 5008 images.

Re: Resizing multiple dimensions, multiple formats

Posted: 2016-09-26T04:48:54-07:00
by snibgo
But you are converting a single JPEG. There is only one image.

Re: Resizing multiple dimensions, multiple formats

Posted: 2016-09-26T05:09:31-07:00
by bibby
snibgo wrote:Chunks like this:

Code: Select all

\(+clone -quality 85 -write 'test 3000.webp' +delete \) \
\( +clone -quality 85 -write '/test 3000.jpeg' +delete \) \
\( +clone -quality 85 -write 'test 3000.png' +delete \) \
... can be replaced by:

Code: Select all

-quality 85 +write 'test 3000.webp'  +write '/test 3000.jpeg' -write 'test 3000.png' +delete \
Note the first two writes are "+", not "-". (I always use "+", but for best performance, when you don't need "+", "-" is quicker.)
I have re-written the command to:

Code: Select all

time \
convert -monitor 'test.jpg' \
        \( +clone -resize 3000x -quality 85 \
                +write 'test 3000.webp' \
                +write 'test 3000.jpeg' \
                -write 'test 3000.png' \
                +delete \) \
        \( +clone -resize 2000x -quality 85 \
                +write 'test 2000.webp' \
                +write 'test 2000.jpeg' \
                -write 'test 2000.png' \
                +delete \) \
        \( +clone -resize 1000x -quality 85 \
                +write 'test 1000.webp' \
                +write 'test 1000.jpeg' \
                -write 'test 1000.png' \
                +delete \) \
        \( +clone -resize 500x -quality 85 \
                +write 'test 500.webp' \
                +write 'test 500.jpeg' \
                -write 'test 500.png' \
                +delete \) \
        \( +clone -resize 200x -quality 85 \
                +write 'test 200.webp' \
                +write 'test 200.jpeg' \
                -write 'test 200.png' \
                +delete \) \
        \( +clone -resize 100x -quality 85 \
                +write 'test 100.webp' \
                +write 'test 100.jpeg' \
                -write 'test 100.png' \
        +delete \) \
        null:
Running the output I measured the time for each of the steps by recording it and counting the frames from when each line of output appears to when the next line appears:
load image[test.jpg]: 2591 of 2592, 100% complete 15 0.64 seconds
resize image[test.jpg]: 5007 of 5008, 100% complete 1 seconds
Load/Image//tmp[magick-18504K38NDRnSlwfl]: 2007 of 2008, 100% complete 9.88 seconds
save image[test 3000.jpeg]: 2007 of 2008, 100% complete 0.4 seconds
load image[test 3000.png]: 2007 of 2008, 100% complete 8 seconds
resize image[test.jpg]: 3338 of 3339, 100% complete 0.6 seconds
Load/Image//tmp[magick-18504VtHZldeqmTj8]: 1338 of 1339, 100% complete 4.2 seconds
save image[test 2000.jpeg]: 1338 of 1339, 100% complete 0.16 seconds
load image[test 2000.png]: 1338 of 1339, 100% complete 3.5 seconds
resize image[test.jpg]: 1668 of 1669, 100% complete 0.63 seconds
Load/Image//tmp[magick-18504ce7vlAUo6jjh]: 668 of 669, 100% complete 1.1 seconds
save image[test 1000.jpeg]: 668 of 669, 100% complete 0.9 seconds
load image[test 1000.png]: 668 of 669, 100% complete
resize image[test.jpg]: 834 of 835, 100% complete
Load/Image//tmp[magick-18504nj-ATgOitl7g]: 334 of 335, 100% complete
save image[test 500.jpeg]: 334 of 335, 100% complete
load image[test 500.png]: 334 of 335, 100% complete
resize image[test.jpg]: 333 of 334, 100% complete
Load/Image//tmp[magick-18504hWSzeCIRQpFN]: 133 of 134, 100% complete
save image[test 200.jpeg]: 133 of 134, 100% complete
load image[test 200.png]: 133 of 134, 100% complete
resize image[test.jpg]: 166 of 167, 100% complete
Load/Image//tmp[magick-185045Bgj1_RmkTmw]: 66 of 67, 100% complete
save image[test 100.jpeg]: 66 of 67, 100% complete
load image[test 100.png]: 66 of 67, 100% complete

real 0m32.572s
user 0m32.756s
sys 0m1.260s
Unfortunately this isn't any faster than it was previously.
snibgo wrote:But if the image is 3000x3000, why does a line say:
5007 of 5008
5000x5000 would take 200 MB, times three is 600 MB, so creeping up to your 2.4 GB.
I have no idea, the precise dimensions of the image are 3872x2592

Re: Resizing multiple dimensions, multiple formats

Posted: 2016-09-26T05:21:31-07:00
by bibby
I attempted to use MPR again as follows:

Code: Select all

time \
convert -monitor 'test.jpg' -write mpr:foo +delete \
        \( mpr:foo -resize 3000x -quality 85 \
                +write 'test 3000.webp' \
                +write 'test 3000.jpeg' \
                -write 'test 3000.png' \
                 \) \
        \( mpr:foo -resize 2000x -quality 85 \
                +write 'test 2000.webp' \
                +write 'test 2000.jpeg' \
                -write 'test 2000.png' \
                 \) \
        \( mpr:foo -resize 1000x -quality 85 \
                +write 'test 1000.webp' \
                +write 'test 1000.jpeg' \
                -write 'test 1000.png' \
                 \) \
        \( mpr:foo -resize 500x -quality 85 \
                +write 'test 500.webp' \
                +write 'test 500.jpeg' \
                -write 'test 500.png' \
                 \) \
        \( mpr:foo -resize 200x -quality 85 \
                +write 'test 200.webp' \
                +write 'test 200.jpeg' \
                -write 'test 200.png' \
                 \) \
        \( mpr:foo -resize 100x -quality 85 \
                +write 'test 100.webp' \
                +write 'test 100.jpeg' \
                -write 'test 100.png' \
                \) \
        null:

Code: Select all

load image[test.jpg]: 2591 of 2592, 100% complete
resize image[foo]: 5007 of 5008, 100% complete
Load/Image//tmp[magick-19009cL_UcmVI5geL]: 2007 of 2008, 100% complete
save image[test 3000.jpeg]: 2007 of 2008, 100% complete
load image[test 3000.png]: 2007 of 2008, 100% complete
resize image[foo]: 3338 of 3339, 100% complete
Load/Image//tmp[magick-19009tQejl4MM6f37]: 1338 of 1339, 100% complete
save image[test 2000.jpeg]: 1338 of 1339, 100% complete
load image[test 2000.png]: 1338 of 1339, 100% complete
resize image[foo]: 1668 of 1669, 100% complete
Load/Image//tmp[magick-19009toTimHZiMh9L]: 668 of 669, 100% complete
save image[test 1000.jpeg]: 668 of 669, 100% complete
load image[test 1000.png]: 668 of 669, 100% complete
resize image[foo]: 834 of 835, 100% complete
Load/Image//tmp[magick-19009TPg-RcKQelWc]: 334 of 335, 100% complete
save image[test 500.jpeg]: 334 of 335, 100% complete
load image[test 500.png]: 334 of 335, 100% complete
resize image[foo]: 333 of 334, 100% complete
Load/Image//tmp[magick-19009dgB13N1Ama88]: 133 of 134, 100% complete
save image[test 200.jpeg]: 133 of 134, 100% complete
load image[test 200.png]: 133 of 134, 100% complete
resize image[foo]: 166 of 167, 100% complete
Load/Image//tmp[magick-19009KfNyAgoxj2eh]: 66 of 67, 100% complete
save image[test 100.jpeg]: 66 of 67, 100% complete
load image[test 100.png]: 66 of 67, 100% complete
write image[]: 5 of 6, 100% complete

real	0m31.632s
user	0m31.384s
sys	0m1.208s
The timings are pretty much unchanged, is this correct use of MPR?

Re: Resizing multiple dimensions, multiple formats

Posted: 2016-09-26T05:48:15-07:00
by snibgo
Your use of mpr looks fine. I wouldn't expect it to be noticably faster or slower than using clone, nor make much difference to memory usage.
Load/Image//tmp[magick-19009cL_UcmVI5geL]:
It seems to be using a temporary image on disk. This happens when there is not enough real memory.
load image[test 2000.png]:
I don't understand why it is reading "test 2000.png", and other files. It should only be writing them.

Can you try the same command on a computer with more memory?

Can you upload test.jpg, or any image that has the problem, to somewhere like dropbox.com and paste the URL here?

Re: Resizing multiple dimensions, multiple formats

Posted: 2016-09-26T07:31:34-07:00
by bibby
snibgo wrote:
Load/Image//tmp[magick-19009cL_UcmVI5geL]:
It seems to be using a temporary image on disk. This happens when there is not enough real memory.

Can you try the same command on a computer with more memory?

Can you upload test.jpg, or any image that has the problem, to somewhere like dropbox.com and paste the URL here?
I ran the most recent command (the one using MPR) on a Windows machine using the same source image, the output is below:

Code: Select all

load image[test.jpg]: 2591 of 2592, 100% complete
resize image[foo]: 5007 of 5008, 100% complete
save image[test 3000.webp]: 2007 of 2008, 100% complete
encode image[test 3000.webp]: 99 of 100, 100% complete
save image[test 3000.jpeg]: 2007 of 2008, 100% complete
load image[test 3000.png]: 2007 of 2008, 100% complete
resize image[foo]: 3338 of 3339, 100% complete
save image[test 2000.webp]: 1338 of 1339, 100% complete
encode image[test 2000.webp]: 99 of 100, 100% complete
save image[test 2000.jpeg]: 1338 of 1339, 100% complete
load image[test 2000.png]: 1338 of 1339, 100% complete
resize image[foo]: 1668 of 1669, 100% complete
save image[test 1000.webp]: 668 of 669, 100% complete
encode image[test 1000.webp]: 99 of 100, 100% complete
save image[test 1000.jpeg]: 668 of 669, 100% complete
load image[test 1000.png]: 668 of 669, 100% complete
resize image[foo]: 834 of 835, 100% complete
save image[test 500.webp]: 334 of 335, 100% complete
encode image[test 500.webp]: 99 of 100, 100% complete
save image[test 500.jpeg]: 334 of 335, 100% complete
load image[test 500.png]: 334 of 335, 100% complete
resize image[foo]: 333 of 334, 100% complete
save image[test 200.webp]: 133 of 134, 100% complete
encode image[test 200.webp]: 99 of 100, 100% complete
save image[test 200.jpeg]: 133 of 134, 100% complete
load image[test 200.png]: 133 of 134, 100% complete
resize image[foo]: 166 of 167, 100% complete
save image[test 100.webp]: 66 of 67, 100% complete
encode image[test 100.webp]: 99 of 100, 100% complete
save image[test 100.jpeg]: 66 of 67, 100% complete
load image[test 100.png]: 66 of 67, 100% complete
write image[]: 5 of 6, 100% complete
Since this is running on Windows I had to time it with a stopwatch and it took ~24seconds. The slowest steps are the "loading" of the PNGs, I don't really know what this means either.

The version of ImageMagick used:

Code: Select all

>convert -version
Version: ImageMagick 6.9.2-6 Q16 x64 2015-11-14 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2015 ImageMagick Studio LLC
License: http://www.imagemagick.org/script/license.php
Visual C++: 180040629
Features: Cipher DPC Modules OpenMP
Delegates (built-in): bzlib cairo freetype jng jp2 jpeg lcms lqr openexr pangocairo png ps rsvg tiff webp xml zlib
It is actually the same machine as the Linux commands from earlier, I am running the Linux in a virtual machine.

On the Windows host there is 12GiB RAM. The Linux guest only has access to half the CPU, so the Windows OS is effectively twice as fast (well, depending on usage of cores).

As a note the convert command barely tickled the available memory:
Image
(alternate sources in case of 404:
http://s4.postimg.org/50qwub231/memory_Usage.png
http://i63.tinypic.com/24x15ok.png
http://imgur.com/a/wl1pr)
Also, observing disk activity, convert doesn't seem to be hitting the disk particularly hard either, peaking at around 1.3mb/s.

The source image "test.jpg" can be found here: http://upload.wikimedia.org/wikipedia/c ... side_a.JPG

Re: Resizing multiple dimensions, multiple formats

Posted: 2016-09-26T07:52:37-07:00
by bibby
I just installed ImageMagick-7.0.3-Q8 and ImageMagick-7.0.3-Q16, the same command (on the Windows machine) took ~26 seconds.

Re: Resizing multiple dimensions, multiple formats

Posted: 2016-09-26T08:32:11-07:00
by snibgo
My laptop is Windows 8.1, with Cygwin. IM v6.9.5-3.

Nova_scotia_countryside_a.JPG is 3872x2592 pixels.

Running your "with mpr" script on Cygwin bash doesn't use temporary files and doesn't read "test 2000.png".

Code: Select all

load image[Nova_scotia_countryside_a.JPG]: 2591 of 2592, 100% complete
resize image[foo]: 5007 of 5008, 100% complete
save image[test 3000.webp]: 2007 of 2008, 100% complete
encode image[test 3000.webp]: 99 of 100, 100% complete
save image[test 3000.jpeg]: 2007 of 2008, 100% complete
save image[test 3000.png]: 2007 of 2008, 100% complete
resize image[foo]: 3338 of 3339, 100% complete
save image[test 2000.webp]: 1338 of 1339, 100% complete
encode image[test 2000.webp]: 99 of 100, 100% complete
save image[test 2000.jpeg]: 1338 of 1339, 100% complete
save image[test 2000.png]: 1338 of 1339, 100% complete
resize image[foo]: 1668 of 1669, 100% complete
save image[test 1000.webp]: 668 of 669, 100% complete
encode image[test 1000.webp]: 99 of 100, 100% complete
save image[test 1000.jpeg]: 668 of 669, 100% complete
save image[test 1000.png]: 668 of 669, 100% complete
resize image[foo]: 834 of 835, 100% complete
save image[test 500.webp]: 334 of 335, 100% complete
encode image[test 500.webp]: 99 of 100, 100% complete
save image[test 500.jpeg]: 334 of 335, 100% complete
save image[test 500.png]: 334 of 335, 100% complete
resize image[foo]: 333 of 334, 100% complete
save image[test 200.webp]: 133 of 134, 100% complete
encode image[test 200.webp]: 99 of 100, 100% complete
save image[test 200.jpeg]: 133 of 134, 100% complete
save image[test 200.png]: 133 of 134, 100% complete
resize image[foo]: 166 of 167, 100% complete
save image[test 100.webp]: 66 of 67, 100% complete
encode image[test 100.webp]: 99 of 100, 100% complete
save image[test 100.jpeg]: 66 of 67, 100% complete
save image[test 100.png]: 66 of 67, 100% complete
write image[]: 5 of 6, 100% complete

real    0m16.823s
user    0m0.000s
sys     0m0.000s
I don't know what "5007 of 5008" etc represent.

It takes about 17 seconds. The slowest operaton is writing the PNG files. Task Manager reports that it uses 169 MB memory. (TM exagerates memory usage when there is no need for garbage collection, or something.)

Converting the script to Windows BAT takes the same: 17 seconds, 174 MB.

I should have noted earlier that "-quality 85" for JPG means something quite different for PNG. See http://www.imagemagick.org/script/comma ... hp#quality

For PNG, compression is always lossless. "-quality" affects speed and size of the output. If we use "-quality 05" before each write to a PNG, the time reduces to 7 seconds, and the size of all the PNGs reduce slightly.

Removing "-monitor" saves another couple of seconds, bringing it down to 5 seconds.

Code: Select all

%IM%convert "Nova_scotia_countryside_a.JPG" -write mpr:foo +delete ^
        ( mpr:foo -resize 3000x -quality 85 ^
                +write "test 3000.webp" ^
                +write "test 3000.jpeg" ^
                -quality 05 -write "test 3000.png" ^
                 ) ^
        ( mpr:foo -resize 2000x -quality 85 ^
                +write "test 2000.webp" ^
                +write "test 2000.jpeg" ^
                -quality 05 -write "test 2000.png" ^
                 ) ^
        ( mpr:foo -resize 1000x -quality 85 ^
                +write "test 1000.webp" ^
                +write "test 1000.jpeg" ^
                -quality 05 -write "test 1000.png" ^
                 ) ^
        ( mpr:foo -resize 500x -quality 85 ^
                +write "test 500.webp" ^
                +write "test 500.jpeg" ^
                -quality 05 -write "test 500.png" ^
                 ) ^
        ( mpr:foo -resize 200x -quality 85 ^
                +write "test 200.webp" ^
                +write "test 200.jpeg" ^
                -quality 05 -write "test 200.png" ^
                 ) ^
        ( mpr:foo -resize 100x -quality 85 ^
                +write "test 100.webp" ^
                +write "test 100.jpeg" ^
                -quality 05 -write "test 100.png" ^
                ) ^
        null:
I suggest you try "-quality 05". If you still get temporary files, and loading of "test 3000.png" etc, I don't know what to suggest. What does "convert -list format" show for PNG? I get:

Code: Select all

      PNG* rw-   Portable Network Graphics (libpng 1.6.20)

Re: Resizing multiple dimensions, multiple formats

Posted: 2016-09-26T08:54:33-07:00
by bibby
I had forgotten about the PNG -quality thing, I re-ran the command (on Windows) with -quality 05 for the PNG output files and it ran in 10 seconds. The "loading" entry no longer appears for PNG output, without looking up the documentation I would assume that previously ImageMagick was doing some kind of multi-pass compression for PNG? Also, the temp files no longer seem to be produced.

Furthermore, removing -monitor reduces total time to ~8 seconds for me.

For the record "convert -list format" shows the following:
Windows (7.0.3 64bit Q8):

Code: Select all

PNG* rw-   Portable Network Graphics (libpng 1.6.25)
Linux:

Code: Select all

PNG* rw-   Portable Network Graphics (libpng 1.2.50,1.2.56)
I think that 8 seconds is reasonable for what I am trying to achieve, so I would consider the matter closed, unless anybody can dream up some extra magic that would be even faster. I could use something other than -resize, but I would prefer the higher quality.

But as an aside, what is the difference between +write and -write?

Re: Resizing multiple dimensions, multiple formats

Posted: 2016-09-26T09:34:09-07:00
by snibgo
The write command may want to modify the image, to prepare it for output. For example the image may have more than 256 colours but the output format needs 256 or fewer.

"-write" will modify the image in memory, then write it to disk. Any subsequent processing (including any more writes) will use that modified version. I don't usually want this behaviour.

"+write" first makes a copy (like a clone), does any modifications to that copy, writes it, and discards the copy. So if modification is needed, this needs more memory and time, but leaves the image in the list unchanged.

If the image is deleted from the list immediately after the write, both forms have the same effect but "-" may be faster.

These days I always use "+write" because I'm too lazy to figure out when "-write" will do what I want.

Re: Resizing multiple dimensions, multiple formats

Posted: 2016-09-26T10:14:57-07:00
by bibby
snibgo wrote:The write command may want to modify the image, to prepare it for output. For example the image may have more than 256 colours but the output format needs 256 or fewer.

"-write" will modify the image in memory, then write it to disk. Any subsequent processing (including any more writes) will use that modified version. I don't usually want this behaviour.

"+write" first makes a copy (like a clone), does any modifications to that copy, writes it, and discards the copy. So if modification is needed, this needs more memory and time, but leaves the image in the list unchanged.

If the image is deleted from the list immediately after the write, both forms have the same effect but "-" may be faster.

These days I always use "+write" because I'm too lazy to figure out when "-write" will do what I want.
Well, that explanation works for me.

I would like to thank you for your help!