Version: 0.8.2 (using KDE KDE 3.0.5) Installed from: Debian testing/unstable Packages Compiler: 2.95.4 OS: Linux in kuickshow when saving tiff files, results in corrupted images. this is because of imlib requiring LZW compression while saving (which is not available on most platforms because of patent issues). Here's a small routine to save imlib images to tiff files with DEFLATE compression or NO compression. regards, renchi // -- begin code ------------------------------------------------------------------- #include <qstring.h> #include <Imlib.h> extern "C" { #include <tiffio.h> } // if compress is true, tiff file is saved with DEFLATE compression // else with no compression // return 1 if success else 0 int saveTiff(ImlibImage *image, const QString& file, bool compress) { if (!image) return 0; TIFF *tif; unsigned char *data; int y; int w; tif = TIFFOpen(QFile::encodeName(file).data(), "w"); if (tif) { TIFFSetField(tif, TIFFTAG_IMAGEWIDTH, image->rgb_width); TIFFSetField(tif, TIFFTAG_IMAGELENGTH, image->rgb_height); TIFFSetField(tif, TIFFTAG_ORIENTATION, ORIENTATION_TOPLEFT); TIFFSetField(tif, TIFFTAG_BITSPERSAMPLE, 8); TIFFSetField(tif, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG); if (compress) TIFFSetField(tif, TIFFTAG_COMPRESSION, COMPRESSION_DEFLATE); else TIFFSetField(tif, TIFFTAG_COMPRESSION, COMPRESSION_NONE); { TIFFSetField(tif, TIFFTAG_SAMPLESPERPIXEL, 3); TIFFSetField(tif, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_RGB); w = TIFFScanlineSize(tif); TIFFSetField(tif, TIFFTAG_ROWSPERSTRIP, TIFFDefaultStripSize(tif, -1)); for (y = 0; y < image->rgb_height; y++) { data = image->rgb_data + (y * image->rgb_width * 3); TIFFWriteScanline(tif, data, y, 0); } } TIFFClose(tif); return 1; } return 0; }
Subject: Re: New: corrupted tiff files when saving On Friday 17 January 2003 00:37, you wrote: Hi renchi, sorry for the late response, I was terribly busy the last weeks. > in kuickshow when saving tiff files, results in corrupted images. this is > because of imlib requiring LZW compression while saving (which is not > available on most platforms because of patent issues). Here's a small > routine to save imlib images to tiff files with DEFLATE compression or NO > compression. Thanks a lot for the code! I'm wondering how to detect whether LZW compression is available or not. Do you have an idea? Ideally, this should go directly into Imlib, instead of KuickShow, right? I'm not sure if this version is still maintained, but could you try reaching the current maintainer? Otherwise, I'll integrate this in KuickShow. I may need to add image saving routines anyway, e.g. for lossless saving of jpegs. Best wishes Carsten Pfeiffer -----BEGIN PGP SIGNATURE----- iQEVAwUBPj8MhaWgYMJuwmZtAQFDfAf/duzXGaArRAzUcdEZjFLA3m17pOXI6uoD nA8PNxz0CX6Hvnz0XlAYXLhS0KN5GbB+NSQ2nZa/AOkTNhR5qYWOzjapGRoEbtxp Ovjdd+Cq1CZqt3i7yvGfK1pG14oMclq1L4vjxa19sMKfNTOLhK2MWsOEzVj9QC67 H9CJRlo2ARbnpFYfIUeuAovcBj4FlqlcDdtRnFaQxlZ/NxOC175eEdguF9C1JTDy NKGUmQQeCTw7ZxD6jcAUjsnZzu2lImbHBeCxpOy6aTyKHNcxkFztq1/gJvOc9OeQ MsdU13o75y/3iWhiz8I7fcdYJt4Bwz26rTcBojJKxkb6VOPC7PXyqg== =9WBz -----END PGP SIGNATURE-----
Subject: Re: corrupted tiff files when saving On Tue, Feb 04, 2003 at 12:43:30AM -0000, Carsten Pfeiffer wrote: > > Thanks a lot for the code! I'm wondering how to detect whether LZW compression > is available or not. Do you have an idea? Ideally, this should go directly > into Imlib, instead of KuickShow, right? I'm not sure if this version is > still maintained, but could you try reaching the current maintainer? > > Otherwise, I'll integrate this in KuickShow. I may need to add image saving > routines anyway, e.g. for lossless saving of jpegs. Hi Carsten, I couldn't find a way either to detect LZW compression availability. I talked to the imlib maintainers and they told me that imlib1 is no longer maintained and asked me to submit a patch against imlib2 (which i did just 5 mins back). i guess its safe to use COMPRESSION_DEFLATE, as its patent free and is lossless like COMPRESSION_LZW. I would advise using the code i submitted till you transition to imlib2. btw, excellent work on kuickshow. i used it as a basis for the imageviewer (in a QScrollview though) for my application (http://digikam.sourceforge.net). i would be changing over to imlib2 sometime soon (most of the code has been written for it). just haven't found a way to change brightness/gamma/contrast as easily as in imlib1. regards, renchi
Subject: Re: corrupted tiff files when saving On Tuesday 04 February 2003 16:21, you wrote: Hi Renchi, > I couldn't find a way either to detect LZW compression availability. I > talked to the imlib maintainers and they told me that imlib1 is no > longer maintained and asked me to submit a patch against imlib2 (which i I was afraid they'd not maintain it anymore :( > did just 5 mins back). i guess its safe to use COMPRESSION_DEFLATE, as > its patent free and is lossless like COMPRESSION_LZW. I would advise > using the code i submitted till you transition to imlib2. Ok. About the transition to Imlib2 -- I actually tried to do this right after Imlib2 was released. But when I had a look at it, I noticed, that it was basically impossible to use it in a sane manner for KuickShow. I discussed this with Rasterman and sent a patch to make it usable at all (the imlib_set_context() thing you may have noticed). But even with this, I noticed that some things were lacking (brightness, contrast, gamma, as you already noticed), printing and the worst thing was: the performance was worse than that of Imlib1. So that's why I decicded to stay with Imlib1 until something superior is appearing. > btw, excellent work on kuickshow. i used it as a basis for the Thanks :) > imageviewer (in a QScrollview though) for my application > (http://digikam.sourceforge.net). i would be changing over to imlib2 Ahh, good to know. It's really sad -- I still don't have a digital camera -- I'd really like to check out all those cool tools and have them somehow interoperate or integrate. Best wishes Carsten Pfeiffer -----BEGIN PGP SIGNATURE----- iQEVAwUBPkHRwqWgYMJuwmZtAQHo0gf+KQ9mhKVlhoexH6nDnQDtIrVUSQcfA6hs f56UdgMYmvip7PFChXkepsSvg2JPJl/7HJODURhZn6DL8BhpdWe2UnGOew9HJ8yJ za6sQVfTJQj8TgvAFbq/1AapBNbvhUHrHNG4A2VA5XMJIm9jFMqOwmOcY/wyfsSr /EMMUM1YqpdGEGuTuwMCegkFLqPmH/IoqlQbRRqJakexuXMBqUcDqkw1I7yi2tqM ffkZAIGfrFvAl7MhSTIzbrTRV0IdUSkceWe4gkivhjZIjETPhRZnnGpfDj0Qbwu8 0tkL9tKlHhhE+aN/kwUsdFFZQdgXqLwD44f0jDBWDFBuOr6bLRVN1Q== =3DRb -----END PGP SIGNATURE-----
Is this bug still there in a recent version of KDE, such as 3.5.8 or KDE4.0 RC2?
Thanks for your bug report or feature request. The Kuickshow application is no longer maintained, and all open tickets are now closed. See also http://websvn.kde.org/?view=revision&revision=1383834