| <<<Back 1 day (to 2016/06/10) | 20160611 |
halabund | Can I get gs to output âusualâ (RGB, 8-bit per channel) TIFF files which are losslessly compressed? There are so many TIFF devices, Iâm confused. | 07:57.54 |
| I used tiff24nc and the output is just huge due to lac of compression | 07:58.12 |
kens | Hmm, intereesting question, let me see | 08:01.22 |
halabund | stupid journal first forces me to convert from PDF to EPS, then they rescale the EPS, break everything, and complain that the font sizes are wrong, then finally they complain that the gs-generated EPS I sent crashes Illustrator even though they have no reason to open my figure in Illustrator and mess with it. | 08:01.23 |
| sorry | 08:01.30 |
| just fed up with the whole thing | 08:01.35 |
| kens: Itâs no big deal, Iâll just us tiffcp to recompress the output. It went from 22 MB to 0.5 MB. | 08:02.02 |
| with LZW | 08:02.32 |
kens | There's tifflzw which is lzw compressed, but I'm ont sure what the colour model or pixel depth is | 08:02.32 |
| The TIFF devices tend to be RGB or gray, I'd expect tifflzw to be good for you, let me try it | 08:02.58 |
halabund | Iâll try it ... | 08:03.13 |
| itâs gray | 08:03.30 |
kens | Yes :-( | 08:03.44 |
halabund | it produced black and white with smaller and larger dots to simulate gray, like printers do | 08:04.00 |
kens | Yeah its halftoned | 08:04.06 |
halabund | but itâs really no big deal, the tiff24nc gives me what I want and I can compress it with another tool. :) | 08:04.25 |
kens | Well, that may be easier | 08:04.37 |
halabund | kens: What is really the point of the scaled devices? Which the documentation say rasterize at high resolution then downscale? | 08:05.08 |
| Like tiffscaled24 | 08:05.15 |
kens | THey all seem to be gray I'm afraid, apart from the uncompressed ones | 08:05.17 |
| The scaled devices get you effectively anti-aliased output | 08:05.33 |
| In a way which actually works reliably | 08:05.55 |
| When the pixels are scaled down, the result is an 'average' of the pixels, which is what anti-aliasing is al about | 08:07.07 |
| For some reason people like blurred output, so they want anti-aliasing :-) | 08:07.25 |
halabund | perhaps at high resolution (for print) thereâs no real need for that (?) | 08:08.37 |
| Iâll go with the non-scaled one | 08:08.46 |
kens | Well, I've never been a fan of anti-aliased output myself...... | 08:08.58 |
| Above about 1000 dpi the human eye can't resolve individual pixels, so the 'smoothing' effect of anti-aliasing is irrelevant, that's certainly true | 08:09.46 |
| Even above 600 dpi its more or less pointless IMO | 08:09.58 |
| halabund, just had an email from a colleague (who is supposed to be on vacation!) saying that you can alter the compression used by the tiff devices by using -sCompression= | 08:23.47 |
halabund | Great! Iâll try it. | 08:24.07 |
kens | valid options are; none, crle, g3, g4, lzw and pack | 08:24.08 |
| THe option has to be valid of course, so you can't (for example) use g4 compression on gray/colour output | 08:24.44 |
| But you should be able to use lzw to get compressed TIFF output directly | 08:25.08 |
| Seems to work well for me | 08:25.59 |
| 1.5MB uncompressed became 7KB compressed | 08:26.48 |
| Obviously that was for a dumb input; a green rectangle, and so compresses unreasonably well | 08:27.15 |
halabund | I should have noticed it in the documentatio: | 08:27.24 |
| âThe tiffsep device creates multiple output files: a single 32 bit composite CMYK file and multiple tiffgray files, one for each separation. The default compression is lzw but this may be overridden by the -sCompression= option." | 08:27.25 |
kens | Well, I didn't notice it either..... | 08:27.40 |
halabund | The tiffcp tool compresses better though. I get 806 kB with gs and with standard tiffcp compression. I get ~400 kB if I use the setting âlzw:2â in tiffcp. Thatâs âLZW-encoded data with horizontal differencingâ, whatever that means. | 08:29.16 |
| Both are much much better than the uncompressed 22 MB. | 08:29.50 |
kens | I imagine that means that before applying compression it first 'differences' each row of data | 08:29.52 |
| SO take row 1, and row 2. Subtract row 2 from row 1 so that it only contains the 'differences' from row 1. Compress row 1 and store, compress the row 2 differences and store. Repeat for all rows. | 08:30.41 |
| Image dtaa often has large areas where each row of raster data is very nearly the same as the preceding row | 08:31.21 |
| This means that the 'differences' are mostly '0' (ie no difference). Long runs of '0' compress very well. | 08:31.56 |
| Of course there is a trade off, it takes longer, and very slightly more memory, to compress and decompress | 08:32.20 |
psmlbhor | kens, the binary worked and the file size even reduced to half. As I am using language level 2, can you suggest another filter in place of Flate ? | 09:42.32 |
kens | No. | 09:42.46 |
| Why are you using level 2? | 09:43.04 |
| Use level 3 | 09:43.05 |
psmlbhor | my mentor said to used level 2 for maintaining compatibility with even very old printers | 09:43.42 |
kens | Nonsense, level 3 is quite old enough | 09:43.56 |
| level 3 dates from 1999 and was widely adopted, I find it hard to believe anyone is still using a real printer which doesn't support level 3 | 09:44.57 |
| However, if you want other filters, then consult the 2nd edition PLRM for available compression/decompression filters | 09:45.22 |
psmlbhor | kens, I will talk with him. Thanks for all your help | 09:46.07 |
kens | Or in fact the 3rd edition PLRM which helpfully states which filters are level 3 | 09:46.15 |
| Forward 1 day (to 2016/06/12)>>> | |