conversion to RLE coded tga fails
conversion to RLE coded tga fails
Hi,
I've tried to convert images to tga and to runlength encoded tga.
First worked well, second not.
convert image.bmp image1.tga
convert image.bmp -compress RLE image2.tga
It appears to me that RLE compression for targa doesn't work at all.
Because image2.tga is identical to image1.tga.
Same result for
convert image.bmp -compress RunlengthEncoded image3.tga
Tested the behaviour with png and bmp as source images on ImageMagick 6.3.7 02/19/08 Q16 (linux)
and ImageMagick-6.4.4-10-Q8-windows-static.exe.
I've tried to convert images to tga and to runlength encoded tga.
First worked well, second not.
convert image.bmp image1.tga
convert image.bmp -compress RLE image2.tga
It appears to me that RLE compression for targa doesn't work at all.
Because image2.tga is identical to image1.tga.
Same result for
convert image.bmp -compress RunlengthEncoded image3.tga
Tested the behaviour with png and bmp as source images on ImageMagick 6.3.7 02/19/08 Q16 (linux)
and ImageMagick-6.4.4-10-Q8-windows-static.exe.
Re: conversion to RLE coded tga fails
[quote="tobyas"]Hi,
I've tried to convert images to tga and to runlength encoded tga.
First worked well, second not.
convert image.bmp image1.tga
convert image.bmp -compress RLE image2.tga
It appears to me that RLE compression for targa doesn't work at all.
Because image2.tga is identical to image1.tga.
Same result for
convert image.bmp -compress RunlengthEncoded image3.tga
Tested the behaviour with png and bmp as source images on ImageMagick 6.3.7 02/19/08 Q16 (linux)
and ImageMagick-6.4.4-10-Q8-windows-static.exe.[/quote]
Hello
It seems that there is no RLE coding for TGA in the IM code.
I've tried to convert images to tga and to runlength encoded tga.
First worked well, second not.
convert image.bmp image1.tga
convert image.bmp -compress RLE image2.tga
It appears to me that RLE compression for targa doesn't work at all.
Because image2.tga is identical to image1.tga.
Same result for
convert image.bmp -compress RunlengthEncoded image3.tga
Tested the behaviour with png and bmp as source images on ImageMagick 6.3.7 02/19/08 Q16 (linux)
and ImageMagick-6.4.4-10-Q8-windows-static.exe.[/quote]
Hello
It seems that there is no RLE coding for TGA in the IM code.
Re: conversion to RLE coded tga fails
ImageMagick reads RLE-encoded Targa images but only writes uncompressed Targa.
Re: conversion to RLE coded tga fails
Hi jpiquemal and magick,magick wrote:ImageMagick reads RLE-encoded Targa images but only writes uncompressed Targa.
thanks for your reply. I know now, why it did not worked as expected.
Maybe I overlooked it, but I couldn't found this information in any kind of documentation.
If this is the case, I would suggest to add a note to the format list.
convert -list format | grep TGA
As I am a user 'only' in the meaning of IM, I will manually use GIMP for the rle conversion of Targa images...
Re: conversion to RLE coded tga fails
Hi!
In 2008, magick wrote: "ImageMagick reads RLE-encoded Targa images but only writes uncompressed Targa".
Is it still the case today?
Many thanks!
In 2008, magick wrote: "ImageMagick reads RLE-encoded Targa images but only writes uncompressed Targa".
Is it still the case today?
Many thanks!
Re: conversion to RLE coded tga fails
This has not been changed. We still only support uncompressed tga files. I will put it on my todo list
Re: conversion to RLE coded tga fails
Many thanks for your quick answer!
Re: conversion to RLE coded tga fails
Support for RLE compressed TGA files has been added. The next version of ImageMagick (6.8.9-2) will include this.
Re: conversion to RLE coded tga fails
That's awesome!
I did update to the latest IM (6.9.1) yesterday and tried this out. Writing RLE TGA files is working like a charm, I'm very happy. (I was relying on a RLE-Compressed TGA writer that I wrote myself, up to now...)
Now, I would need to detect when I read a TGA file if the TGA is compressed or not. Here's a portion of my code (I'm using Magick++ API)
In the case of a TGA file, it seems that m_compression is always set to MagickCore::NoCompression, even if I read an RLE-compressed TGA (I'm pretty sure the file is effectively RLE-compressed because of its reduced size). Note that the above code is working well with other formats, for instance, the above code will detect a MagickCore::LZWCompression when reading a lzw-compressed tiff file. Also note that the above code was not able to detect a TGA RLE-compressed file written by my own writer.
It also seems to me that m_quality is always set to 0, regardless of how the file was written. Again, I feel I succeeded in writing files with different quality values because of the file size that is changing.
Thank you very much for your help!
Julie
I did update to the latest IM (6.9.1) yesterday and tried this out. Writing RLE TGA files is working like a charm, I'm very happy. (I was relying on a RLE-Compressed TGA writer that I wrote myself, up to now...)
Now, I would need to detect when I read a TGA file if the TGA is compressed or not. Here's a portion of my code (I'm using Magick++ API)
Code: Select all
Magick::Image m_image;
(...)
m_image.read( filename );
m_compression = m_image.compressType();
m_quality = m_image.quality();
In the case of a TGA file, it seems that m_compression is always set to MagickCore::NoCompression, even if I read an RLE-compressed TGA (I'm pretty sure the file is effectively RLE-compressed because of its reduced size). Note that the above code is working well with other formats, for instance, the above code will detect a MagickCore::LZWCompression when reading a lzw-compressed tiff file. Also note that the above code was not able to detect a TGA RLE-compressed file written by my own writer.
It also seems to me that m_quality is always set to 0, regardless of how the file was written. Again, I feel I succeeded in writing files with different quality values because of the file size that is changing.
Thank you very much for your help!
Julie
Re: conversion to RLE coded tga fails
Are you sure that your file really is RLE-compressed? Did you check the output of 'identify -verbose yourfile.tga'? Can you share one of the files? You can PM me if you don't want to share it publicly.
The tga coder does nothing with the quality so it will always report zero. So setting the quality when writing a tga image will not affect the output.
The tga coder does nothing with the quality so it will always report zero. So setting the quality when writing a tga image will not affect the output.
Re: conversion to RLE coded tga fails
Hi there,
Thanks for your quick answer!
I will PM you two versions of a very simple image (so the RLE encoding will be very efficient) in just a few minutes. The file squares.tga is uncompressed with file size of 1407KB and squares_rle.tga is RLE-compressed with file size of 31KB.
I looked at both images in a binary viewer and in particular, at the third bytes of each file. I can see 02 for squares.tga and 0A for squares_rle.tga which is the Image type code corresponding to uncompressed/RLE-compressed TGA file (you already know that...).
Here are portions of the output I got from 'identify -verbose myfile.tga':
identify -verbose squares.tga
Image: squares.tga
Format: TGA (Truevision Targa image)
(...)
Iterations: 0
Compression: None
Orientation: Undefined
(...)
Artifacts:
filename: squares.tga
verbose: true
Tainted: False
Filesize: 1.44MB
(...)
Version: ImageMagick 6.9.1-2 Q16 x64 2015-04-14 http://www.imagemagick.org
identify -verbose squares_rle.tga
Image: squares_rle.tga
Format: TGA (Truevision Targa image)
(...)
Iterations: 0
Compression: None
Orientation: Undefined
(...)
Artifacts:
filename: squares_rle.tga
verbose: true
Tainted: False
Filesize: 31KB
(...)
Version: ImageMagick 6.9.1-2 Q16 x64 2015-04-14 http://www.imagemagick.org
And here's just a quick question about:
Again, thank you very very much for your help. It is highly appreciated...
Julie
Thanks for your quick answer!
I will PM you two versions of a very simple image (so the RLE encoding will be very efficient) in just a few minutes. The file squares.tga is uncompressed with file size of 1407KB and squares_rle.tga is RLE-compressed with file size of 31KB.
I looked at both images in a binary viewer and in particular, at the third bytes of each file. I can see 02 for squares.tga and 0A for squares_rle.tga which is the Image type code corresponding to uncompressed/RLE-compressed TGA file (you already know that...).
Here are portions of the output I got from 'identify -verbose myfile.tga':
identify -verbose squares.tga
Image: squares.tga
Format: TGA (Truevision Targa image)
(...)
Iterations: 0
Compression: None
Orientation: Undefined
(...)
Artifacts:
filename: squares.tga
verbose: true
Tainted: False
Filesize: 1.44MB
(...)
Version: ImageMagick 6.9.1-2 Q16 x64 2015-04-14 http://www.imagemagick.org
identify -verbose squares_rle.tga
Image: squares_rle.tga
Format: TGA (Truevision Targa image)
(...)
Iterations: 0
Compression: None
Orientation: Undefined
(...)
Artifacts:
filename: squares_rle.tga
verbose: true
Tainted: False
Filesize: 31KB
(...)
Version: ImageMagick 6.9.1-2 Q16 x64 2015-04-14 http://www.imagemagick.org
And here's just a quick question about:
In the case of a PNG or a JPEG file written by Magick++ with say, quality = 50, can I retrieve that quality info when reading back that same image with the code I posted yesterday?The tga coder does nothing with the quality so it will always report zero. So setting the quality when writing a tga image will not affect the output.
Again, thank you very very much for your help. It is highly appreciated...
Julie
Re: conversion to RLE coded tga fails
I have e-mailed you because I did not get the files in your PM. When you read a .PNG file you won't be able to read the quality when you read the image again. And when you read a JPEG the quality is 'guessed', it will be really close to the value you used but it does not have to be the same.
Re: conversion to RLE coded tga fails
I can confirm this is a bug in ImageMagick. In the next version of ImageMagick (6.9.1-3) the compression will be 'RLE' instead of 'None'.
Re: conversion to RLE coded tga fails
Thank you for letting me know so quickly.
Do you have an idea of when (approximately, of course) this next version will be available?
Thanks!
Julie
Do you have an idea of when (approximately, of course) this next version will be available?
Thanks!
Julie
Re: conversion to RLE coded tga fails
ImageMagick 6.9.1-3 release will likely be before May 23rd.