logo
Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
Go to last post Go to first unread
eboj74  
#1 Posted : Wednesday, March 15, 2017 10:13:31 PM(UTC)
eboj74

Rank: Newbie

Groups: Registered
Joined: 3/15/2017(UTC)
Posts: 2
Australia

Thanks: 1 times
I have been successfully converting colour tiffs with lzw compression to searchable pdf however tiffs with jpeg compression do not seem to be passed to the ocr engine. could you please advise?

Thanks.
Paul Rayman  
#2 Posted : Thursday, March 16, 2017 6:04:11 AM(UTC)
Paul Rayman

Rank: Administration

Groups: Administrators
Joined: 1/5/2016(UTC)
Posts: 1,138

Thanks: 10 times
Was thanked: 133 time(s) in 130 post(s)
Could you please provide the tiff file?
eboj74  
#3 Posted : Sunday, March 19, 2017 5:26:55 PM(UTC)
eboj74

Rank: Newbie

Groups: Registered
Joined: 3/15/2017(UTC)
Posts: 2
Australia

Thanks: 1 times
1_JPEG.tif (863kb) downloaded 28 time(s). 1_LZW.tif (3,965kb) downloaded 29 time(s).

Hi Paul,

Thanks for you assistance.
PFA two TIF files in with JPEG and LZW compression. The LZW conversion works OK yet the JPEG TIF will not pass to the engine.

Thanks.
Paul Rayman  
#4 Posted : Monday, March 20, 2017 3:40:57 AM(UTC)
Paul Rayman

Rank: Administration

Groups: Administrators
Joined: 1/5/2016(UTC)
Posts: 1,138

Thanks: 10 times
Was thanked: 133 time(s) in 130 post(s)
well...unfortunately there is a problem with the old-style jpeg encoded tiff files.

But I can suggest the following workaround

Code:

using (var api = OcrApi.Create())
{
	api.Init(Languages.English);
	using (var renderer = OcrPdfRenderer.Create(@"D:\4\output_pdf", @"tessdata"))
	{
		renderer.BeginDocument("Title");
		var image = Image.FromFile(@"D:\4\1_JPEG.tif");
		var pages = image.GetFrameCount(FrameDimension.Page);

		for (int index = 0; index < pages; index++)
		{
			image.SelectActiveFrame(FrameDimension.Page, index);
			using (var bmp = new Bitmap(image.Width, image.Height))
			{
				using (var g = Graphics.FromImage(bmp))
				{
					g.DrawImage(image, 0, 0, image.Width, image.Height);
				}

				using (var pix = OcrPix.FromBitmap(bmp))
				{
					api.ProcessPage(pix, null, 0, renderer);
				}
			}
		}
		renderer.EndDocument();
	}
}


Fixed!
​https://forum.patagames.com/posts/t431-Version-1-14-341-was-released-on-Feb-08--2018

Edited by user Thursday, February 8, 2018 2:06:10 AM(UTC)  | Reason: Not specified

thanks 1 user thanked Paul Rayman for this useful post.
eboj74 on 3/29/2017(UTC)
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.