ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder
ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
Forum membership is Free!  Click Join to sign-up
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 Convert colour jpeg to monochrome tiff
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

shackers

United Kingdom
3 Posts

Posted - May 09 2019 :  16:56:17  Show Profile  Reply
I am starting with a colour jpg file about 500KB in size. I want to reduce this considerably in size so I thought I would convert to monochrome tiff in the hope of reducing the file size to around 25-50KB.

So I try:
IEView.IO.LoadFromStreamJpeg(stream);
IEView.IO.params.ImageIndex:=0;
IEView.LegacyBitmap := false;
IEVIEW.IO.Params.TIFF_Compression:=ioTIFF_G4FAX;
IEVIEW.IO.params.BitsPerSample:=1;
IEView.IO.SaveToFileTIFF(myTiffFile);


I end up with a completely black page and a file size of 7.82MB.


What am I doing wrong please?

xequte

4854 Posts

Posted - May 09 2019 :  17:22:40  Show Profile  Reply
Hi

Setting BitsPerSample is not enough to make an image monochrome. You also need to adjust the SamplesPerPixel and downscale the color content.

Firstly, what is the content of the JPEG image? Is it a document?

Please try the dithering demo to get a better understanding of color reduction options:

https://www.imageen.com/demos/index.html#ImageEditing

Nigel
Xequte Software
www.imageen.com
Go to Top of Page

shackers

United Kingdom
3 Posts

Posted - May 10 2019 :  06:26:25  Show Profile  Reply
Thanks.

I'm working with a text document.

I've looked at the demo for dithering.

A simple call to IEView.Proc.ConvertTo(ie1g) gets me a black and white text document, but when I save it as a tiff file I am large file sizes.

The original JPEG is 1MB

Without compression the saved tiff file is 62.5MB


With ioTiff_LZW it is 425KB.


I've tried with ioTIFF_G4FAX, but I just get a black document. I've worked with text documents with the G4FAX compression and I always get excellent results (would expect about 20-30KB for this document. I can't figure out why it doesn't work for this document.

What can I do to improve the compression please?


With a plain text
Go to Top of Page

xequte

4854 Posts

Posted - May 12 2019 :  17:27:39  Show Profile  Reply
Hi

What is your saving code? It should be something like:

// Save a monochrome TIFF image
ImageEnView1.IO.Params.BitsPerSample := 1;
ImageEnView1.IO.Params.SamplesPerPixel := 1;
ImageEnView1.IO.Params.TIFF_Compression := ioTIFF_G4FAX;
ImageEnView1.IO.SaveToFile('D:\output.tif');


Nigel
Xequte Software
www.imageen.com
Go to Top of Page

shackers

United Kingdom
3 Posts

Posted - May 13 2019 :  16:31:11  Show Profile  Reply
Perfect! Thank you.
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To: