XPost: alt.os.linux
On 12/25/2022 2:08 PM, Java Jive wrote:
On 25/12/2022 18:12, Mike wrote:
In article <to9spn$2prqe$[email protected]>,
Java Jive <[email protected]d> wrote:
Can anyone see what the hell is going on here?
$ mogrify -type Grayscale myimage.png
Yes, thank you.
I found that both Windows apps, IrfanView and PaintShop Pro 8, treat both genuine grayscale and 8-bit palette with greyscale colours as 'greyscale', so there's nothing to be done there. Linux GIMP can convert each file manually under Image, Mode, but
that's tedious, so before reading your post I searched on the web for a batch command, and so discovered ...
mogrify -colorspace Gray *.png
... which has solved the problem, and I'm now in business, though have yet to see whether I'm going to have to set the control points manually or automatically.
For some reason or other, probably too many areas looking the same, the latter tends not to work well with this type of input, and I've been getting botched results with it. The manual method, though tedious, tends to work quite well though.
Every now and then, I have a piece of luck and the Windows Image Composite Editor (ICE) program gets it right first time, which happened with the last tree, but sadly not with this one.
Looking at them with a hex editor, one of the images has an obvious
lookup table for the colours. The other does not. The other one
has the four character string "gAMA" as if a gamma curve is being used.
These are structured ahead of an IDAT section. I only examined the
content of each, until I hit IDAT. IDAT is at 0x5D on one image,
and on the other the IDAT is after the lookup table and is at 0x331.
One thing about PNG as a format, is output routines like to try a number
of formats for storage, compare the file size and keep the smallest one.
This notion originated with a piece of software used to reduce PNGs
so they could be served on the web. Not to be outdone, it would seem
some popular library has also taken it upon themselves to do a
version of that reductionism. The difference between them, is the original concept of PNG reduction, did an inordinate number of versions, and had a long run time (nobody cared, since this was for a web server and the effort
would "pay for itself"). The library version, who can say how many it
has tried, before picking one.
If you switch to some other image family (someone mentioned TIF), perhaps
the library that handles those, will "stick to the theme you selected"
and not mess around like PNG does. JPEG would not be a good choice, because
of the rounding errors in the colour space (good conversion routines can rationalize the colour space and return it to normal, but with your
luck so far, this doesn't sound like a good idea :-) ).
Maybe BMP would work, but I don't know enough about the
innards there to comment.
*******
In GIMP, Image : Mode : Grayscale to start.
Then Colours : Threshold and move the slider for a more pleasing result.
This will irritate the hell out of the panorama software though.
Using the threshold, I can keep the text, with only a bit of
noise showing through. There won't be much of anything for the
panorama software to latch onto, but at least the result will be clean.
[Picture]
https://i.postimg.cc/8zx654Wg/threshold.gif
Maybe there's a better adaptive filter out there, to
pull signal out of noise. As using Threshold "chews holes"
in the writing which is not good for overall result.
Looking at the image, it almost looks like something
where a different colour of illumination (UV?) might
pick out the writing better. The "ink" looks different
to my eye than the noise in the image.
Maybe something that recognizes hand writing could
fix up the quality of the scan.
Paul
--- SoupGate-Win32 v1.05
* Origin: fsxNet Usenet Gateway (21:1/5)