[magick-users] Re: is this a bug?
Anthony Thyssen
anthony at griffith.edu.au
Wed Jan 10 18:40:56 CST 2007
"Amadeus W. M." on wrote...
| On Wed, 10 Jan 2007 15:38:21 +1000, Anthony Thyssen wrote:
|
| > "Amadeus W. M." on wrote...
| > | I'm trying to crop a a pgm image like this:
| > |
| > | convert -crop 50x50 lena.pgm tmp.pgm
| > |
| > | The resulting pgm has white value = 65535 rather than 255:
| > |
| > | head -3 tmp.pgm
| > | P5
| > | 50 50
| > | 65535
| > |
| > | even though the original is ok:
| > |
| > | head -3 lena.pgm
| > | P5
| > | 208 222
| > | 255
| > |
| > | Also, the resulting tmp.pgm image has size 92722 bytes rather than
| > | 50x50=2500 as I'd expect (without the header). Despite all this, xv
| > | displays it correctly. I don't understand. What's going on?
| > |
| > | Thanks!
| > |
| > You are using a Q16 version of IM which premotes all color values to 16
| > bit quality (-depth 16).
| >
| > The thrid line just says what the maximum value is for the data
| > that follows.
| >
| > If you want it 255 you can set -depth 8 before saving the PGM file.
| >
|
| I saw the -depth option after I posted. Thanks for the answer. Forgive my
| ignorance, what is a Q16 version of IM? For what it's worth, I'm on a
| Fedora Core 6 system on and
|
It is the compile time build options that defines how many bits each
color value is stored in. Q16 = 2^16 = 2 bytes.
For speed and memory usage people often drop down to a Q8 compile time
option (half the memory use for large images).
| rpm -q ImageMagick
| ImageMagick-6.2.8.0-3.fc6.1
|
| Do I have a choice? I want depth 8 by default. The thing of it is I've been
| using convert for a long time, on a fairly regular basis, and I never
| noticed the depth problem/feature. There was a recent IM update, maybe
| they changed to Q16.
|
It is a compile time setting. You will have to download the SRC RPM
unpack and change the setting built setting.
I myself compile IM for my own system as it avoids some problems of
delegates and differences between fc5 and fc6.
Here is the code I use to get the latest offical Beta release.
The resulting RPMs are saved in 'dl' in my home.
=======8<--------
rm -f ~/dl/ImageMagick-*.{i386,src}.rpm{,.?}
( cd ~/dl
s=ftp://ftp.imagemagick.org/pub/ImageMagick/linux/SRPMS/
wget -O - $s | html2urls $s | grep '[0-9].src.rpm' | tail -1 | wget -i -
)
rm -rf /usr/src/redhat/RPMS/*/* /usr/src/redhat/{SOURCES,SPECS,BUILD}/*
nice rpmbuild --nodeps --rebuild ~/dl/ImageMagick-*.src.rpm
cp -p /usr/src/redhat/RPMS/i386/ImageMagick-[6p]*.i386.rpm ~/dl/
chown anthony.anthony ~/dl/ImageMagick-*
rm -rf /usr/src/redhat/RPMS/*/* /usr/src/redhat/{SOURCES,SPECS,BUILD}/*
#[ -f ~/dl/ImageMagick-6*.i386.rpm ] && rm -f ~/dl/ImageMagick-*.src.rpm
rpm -Uhv --force --nodeps ~/dl/ImageMagick-*.i386.rpm
=======8<--------
The first part is auto find and download script.
The 'rm -rf' lines are a total cleanup of the source area.
You will need to change the 'nice rpmbuild' to install the RPM,
to add the Q8 configuration before building. That is unpack, edit,
and then build the needed RPM's.
EG: instead of "nice rpmbuild..." do...
rpm -hiv ~/dl/ImageMagick-*.src.rpm
vi /usr/src/redhat/SPECS/*
Look for %configure
and add the option
--with-quantum-depth 8 \
rpmbuild -bb /usr/src/redhat/SPECS/*
ASIDE: If you chown the whole /usr/src area to yourself and sudo the
final rpm store, you don't even need root to compile and upgrade your IM
installation.
If anyone has any suggestions or updated to the above semi-automated Im
install method. please let me know.
I use this code to upgrade IM just about every single day (from an
'alpha' testing site), as part of the IM Example rebuild and patch
testing. Eg remove old images, extract IM commands from example web
pages, and run them to re-build all examples.
See IM Examples...
http://www.cit.gu.edu.au/~anthony/graphics/imagick6/
Quote...
In any case just about all the IM example commands given are also
executed in the same web directory in which they appear, to produce
the results also shown. That is the command you see is the command
that was actually used to generate the image.
Sorry, I am waffling... I'll shutup now.
Anthony Thyssen ( System Programmer ) <A.Thyssen at griffith.edu.au>
-----------------------------------------------------------------------------
Created with the No. 1 Rated HTML editor - "vi"
-----------------------------------------------------------------------------
Anthony's Home is his Castle http://www.cit.gu.edu.au/~anthony/
More information about the Magick-users
mailing list