I use old Delphi to occasionally program small utilities, so you can't say I'm good at Delphi. I have used the Gustavo Daud's library in the past
(PNG Delphi v.1.564)
https://torry.net/authorsmore.php?id=6929
Using it on Windows XP, Delphi 7... And now I have found update pngdelphi2 (not tested).
1. WHAT I KNOW ALREADY TO DO:
In the past I already learned how to load png file and print it to image object.
It was like:
Code:
var soubmp, defsoubmp, path, filename, ext, s:string;
stream: TMemoryStream;
Image: TPngObject;
/// ... skipped
Stream := TMemoryStream.Create;
Stream.LoadFromFile( s );
Image := TPngObject.Create;
try ...
try
Image.LoadFromStream(Stream);
Image_center.Picture.Bitmap.Width := Image.Width;
Image_center.Picture.Bitmap.Height := Image.Height;
Image.Draw(Image_center.Picture.Bitmap.Canvas, Rect(0, 0, Image.Width, Image.Height));
Image_center.width := Image.width;
Image_center.height := Image.height;
Image_center.Left := ( form1.clientWidth div 2 ) - (Image_center.width div 2);
CropBitmap(Image_center.Picture.Bitmap, 1, 25, Image.width,Image.height-25);
finally
Image.Free;
end;
finally
Stream.Free;
end;
The code just update image from file... This is all my knowledge about images and png. But now I need to do some advanced work.
I have pngimage with text (black background, text white or colored, can contain images like dialogue cloud with text.). And I want to create program small/easy OCR detection just to find out some things about the image.
2. BACKGROUND: (This is just preparation for complex task because I plan to work with multiple images at time, comparing the images. The images been genarated while scrolling html document and captured to GIF, then converted to PNGs. So the complex thing/goal is to detect the shift of the text and to create another image or frame there between the frames/images because the captured animation image sloped and was not smooth... )
3. THE GOAL:
I would like to use the png library to read line(s) of the image and find out some information like: the gaps height between lines, line height, color of the text in a line (or in the area), areas of text and areas of round box or dialogue cloud ... and positions of these areas. This is important on the end of the image. Of sure I need to save the information. And then I can compare the image with next image to find out if the image is the same or if it was shifted upwards. Then I would like to copy the image, shift it a bit lower, and then I need to copy image from the next image and find out area to copy and to join this into new image... Hard thing to do.
I would like to welcome your ideas and code examples, because this job is so hard for me. Thank you.
Bookmarks