EPS2 output only 1/3 of image when using LZW or rle compress

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
gomyhr

EPS2 output only 1/3 of image when using LZW or rle compress

Post by gomyhr »

I tried posting this on the magick-bugs mailing list, but it was bounced since it apparently considers all mail from gmail as spam:

Using ImageMagick 6.3.7 02/19/08 Q16 which comes with Ubuntu Hardy to
convert an image to EPS level 2 with LZW or RLE compression causes
only the upper 1/3 of the image data to be written to the EPS-file.
The ratio 1/3 is exact, rounded down if the number of lines in the
image is not divisible by 3. Using JPEG compression works fine. LZW
and RLE compression also works fine with EPS level 3.

The bug has also been confirmed on ImageMagick Studio
(http://net11.imagemagick.org/MagickStud ... Studio.cgi)
which I assume runs 6.4.1.

It works without problems in 6.2.4 10/02/07 on Ubuntu Gutsy.

Commands that fail:
convert -compress LZW file.png eps2:file-LZW.eps
convert -compress rle file.png eps2:file-rle.eps
convert -compress LZW file.jpg eps2:file-LZW.eps
convert -compress rle file.jpg eps2:file-rle.eps

Commands that work:
convert -compress LZW file.png eps3:file-LZW.eps
convert -compress rle file.png eps3:file-rle.eps
convert -compress JPEG file.png eps2:file-JPEG.eps
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: EPS2 output only 1/3 of image when using LZW or rle compress

Post by magick »

We have a patch for the problem you reported in ImageMagick 6.4.1-7 Beta available sometime tomorrow.
skoehler

Re: EPS2 output only 1/3 of image when using LZW or rle compress

Post by skoehler »

Sounds just like the bug i posted to bugs-mailingliste with the subject
"png->eps2: conversion is broken"
some days ago.

Has this patch been committed already? I'd like to do some testing.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: EPS2 output only 1/3 of image when using LZW or rle compress

Post by magick »

The current release, ImageMagick 6.4.1-6, includes the patch. Have fun.
skoehler

Re: EPS2 output only 1/3 of image when using LZW or rle compress

Post by skoehler »

Oh my god! :shock:

It's got worse! Now, even the jpeg-compressed eps2 is broken and the eps3 files are VERY huge compared to older imagemagick versions. What happened?

Here are the commands to reproduce:

Code: Select all

wget -O tux.jpg http://www.lokigames.com/press/downloads/tux.jpg
convert tux.jpg tux.png

convert tux.jpg tux1j.eps
convert tux.png tux1p.eps
convert tux.jpg eps2:tux2j.eps
convert tux.png eps2:tux2p.eps
convert tux.jpg eps3:tux3j.eps
convert tux.png eps3:tux3p.eps
For me, that gives:
-rw-r--r-- 1 root root 265168 May 1 2007 tux.jpg
-rw-r--r-- 1 root root 255577 Jun 12 00:28 tux.png
-rw-r--r-- 1 root root 7903001 Jun 12 00:28 tux1j.eps
-rw-r--r-- 1 root root 7903010 Jun 12 00:28 tux1p.eps
-rw-r--r-- 1 root root 143923 Jun 12 00:28 tux2j.eps
-rw-r--r-- 1 root root 143929 Jun 12 00:28 tux2p.eps
-rw-r--r-- 1 root root 4289688 Jun 12 00:28 tux3j.eps
-rw-r--r-- 1 root root 4289700 Jun 12 00:28 tux3p.eps

As you can see, tux2* files are very small! they should be at least as big as the jpeg/png, shouldn't they?
(Actually, tux2j.eps used to be about 270KB in size)

Anyway:
3) tux1[jp].eps both work
1) tux2[jp].eps only show the head of the penguin - his body is missing.
2) tux3[jp].eps both work, but they are not compressed anymore


To confirm my ImageMagick-version:

Code: Select all

Version: ImageMagick 6.4.1 06/12/08 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2008 ImageMagick Studio LLC
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: EPS2 output only 1/3 of image when using LZW or rle compress

Post by magick »

Curious, we're getting 816012 bytes for tux2j.eps and 816018 for tux2p.eps and both display correctly. Perhaps the patch is in the subversion trunk and not the released version. You can test the latest development code by downloading ImageMagick 6.4.1-7 from ftp://ftp.imagemagick.org/pub/ImageMagick/beta.
skoehler

Re: EPS2 output only 1/3 of image when using LZW or rle compress

Post by skoehler »

magick wrote:Curious, we're getting 816012 bytes for tux2j.eps and 816018 for tux2p.eps and both display correctly. Perhaps the patch is in the subversion trunk and not the released version. You can test the latest development code by downloading ImageMagick 6.4.1-7 from ftp://ftp.imagemagick.org/pub/ImageMagick/beta.
OK, so with 6.4.1-7, it works fine.

But the behaviour of the eps2 file format changed, didn't it?
jpeg files don't result in a jpeg compressed eps2 files anymore - i'm not sure if they did with older versions.

Well, i tested some output configurations with this shell-script:

Code: Select all

wget -O tux.jpg http://www.lokigames.com/press/downloads/tux.jpg

convert tux.jpg -compress none  eps:tux1c-none.eps
convert tux.jpg -compress none eps2:tux2c-none.eps
convert tux.jpg -compress none eps3:tux3c-none.eps
convert tux.jpg -compress jpeg  eps:tux1c-jpeg.eps
convert tux.jpg -compress jpeg eps2:tux2c-jpeg.eps
convert tux.jpg -compress jpeg eps3:tux3c-jpeg.eps
convert tux.jpg -compress rle   eps:tux1c-rle.eps
convert tux.jpg -compress rle  eps2:tux2c-rle.eps
convert tux.jpg -compress rle  eps3:tux3c-rle.eps
convert tux.jpg -compress lzw   eps:tux1c-lzw.eps
convert tux.jpg -compress lzw  eps2:tux2c-lzw.eps
convert tux.jpg -compress lzw  eps3:tux3c-lzw.eps
convert tux.jpg -compress zip   eps:tux1c-zip.eps
convert tux.jpg -compress zip  eps2:tux2c-zip.eps
convert tux.jpg -compress zip  eps3:tux3c-zip.eps
The resulting files were:

Code: Select all

-rw-r--r--   1 root root 7903006 Jun 12 03:08 tux1c-jpeg.eps
-rw-r--r--   1 root root 7903005 Jun 12 03:08 tux1c-lzw.eps
-rw-r--r--   1 root root 7903006 Jun 12 03:07 tux1c-none.eps
-rw-r--r--   1 root root 1154337 Jun 12 03:08 tux1c-rle.eps
-rw-r--r--   1 root root 7903005 Jun 12 03:08 tux1c-zip.eps
-rw-r--r--   1 root root  224901 Jun 12 03:08 tux2c-jpeg.eps
-rw-r--r--   1 root root  326834 Jun 12 03:08 tux2c-lzw.eps
-rw-r--r--   1 root root 4289328 Jun 12 03:07 tux2c-none.eps
-rw-r--r--   1 root root  816016 Jun 12 03:08 tux2c-rle.eps
-rw-r--r--   1 root root  816016 Jun 12 03:08 tux2c-zip.eps
-rw-r--r--   1 root root  225297 Jun 12 03:08 tux3c-jpeg.eps
-rw-r--r--   1 root root  327230 Jun 12 03:08 tux3c-lzw.eps
-rw-r--r--   1 root root 4289692 Jun 12 03:07 tux3c-none.eps
-rw-r--r--   1 root root  816364 Jun 12 03:08 tux3c-rle.eps
-rw-r--r--   1 root root  250730 Jun 12 03:08 tux3c-zip.eps
And ALL are working! Very nice indeed!

But there's no way, to convert the "original" jpeg data into eps, right? with "-compress jpeg" the data is recompressed, right?
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: EPS2 output only 1/3 of image when using LZW or rle compress

Post by magick »

Correct, the JPEG pixels are recompressed.
gomyhr

Re: EPS2 output only 1/3 of image when using LZW or rle compress

Post by gomyhr »

skoehler wrote:But there's no way, to convert the "original" jpeg data into eps, right? with "-compress jpeg" the data is recompressed, right?
No way with Imagemagick I suppose. There is a program called jpeg2ps (http://www.pdflib.com/download/free-software/jpeg2ps/) that does it. It is only free as in beer, though.
Post Reply