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
 ImageEnProc.Contrast / DoPreviews Bug
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

jeffp

USA
42 Posts

Posted - Jan 26 2016 :  11:23:27  Show Profile  Reply
I believe there may be a bug in TImageEnProc.Contrast.

When I set

TImageVect.Proc.Contrast(20);
TImageVect.Update;

There is no visible change to the image. The text should get darker.

Also, what is interested is this. When I run

TImageVect.Proc.DoPreviews;

And then set Contrast to 20 on the Contrast tab in the Preview dialog, you can see the text in the image get darker in the "Result" image. But when you press the OK button, the images changes don't stick.

I can do the same exact thing with the "Brightness" setting and those changes do stick.

So there seems to be an issue with Contrast.

--Jeff

jp

xequte

38610 Posts

Posted - Jan 27 2016 :  13:14:22  Show Profile  Reply
Hi Jeff

Proc actions only apply to the image itself, not any objects upon it. You would need to apply the objects to the image (e.g. using CopyObjectsToBack) for the proc actions to take effect.

(DoPreviews shows a quick preview of the image, in this case it is not quite accurate because it shows the objects affected).



Nigel
Xequte Software
www.xequte.com
nigel@xequte.com
Go to Top of Page

jeffp

USA
42 Posts

Posted - Feb 02 2016 :  10:12:05  Show Profile  Reply
I guess I still don't follow. Below is my code and I've added the CopyObjectsToBack procedure as you mentioned, but it has no effect. Perhaps I still don't follow how to make the changes that appear in the Preview window part of my actual image.

viewImage below is my TImageEnVect. I'm adjusting the contract in the Preview window to make the text on my image look darker. It does in the Preview window, but when I click OK the main TImageEnVect doesn't reflect the change.


procedure TfmeViewerImageEn.tbnAdjustmentsClick(Sender: TObject);
begin
  viewImage.Proc.SaveUndo;
  if viewImage.Proc.DoPreviews(ppeColorAdjust, True, 850, 650) then
  begin
    viewImage.CopyObjectsToBack;
    viewImage.Update;
  end else
  begin
    viewImage.Proc.Undo;
  end;
end;


jp
Go to Top of Page

w2m

USA
1990 Posts

Posted - Feb 02 2016 :  10:18:28  Show Profile  Reply
It appears that you are doing a DoPreviews before CopyObjectsToBack. The DoPreviews acts only on the image and not the objects so call CopyObjectsToBack, then call DoPreviews:

procedure TfmeViewerImageEn.tbnAdjustmentsClick(Sender: TObject);
begin
 viewImage.Proc.SaveUndo;
 viewImage.CopyObjectsToBack;
 if viewImage.Proc.DoPreviews(ppeColorAdjust, True, 850, 650) then
 begin
   viewImage.Update;
 end 
 else
 begin
   viewImage.Proc.Undo;
 end;
end;

Bill Miller
Adirondack Software & Graphics
Email: w2m@hughes.net
EBook: http://www.imageen.com/ebook/
Custom Commercial ImageEn Development
Go to Top of Page

jeffp

USA
42 Posts

Posted - Feb 04 2016 :  09:45:14  Show Profile  Reply
I did as you requested, but still no difference. Attached is the file I am using. I has no objects. It is just a scanned .tif file.

If I change the Brightness in DoPreviews, the change is reflected in the image when I press OK. But if I change the Contrast, I see the darkening of the text in the Preview, but when I press OK, the changes are not reflected.

--Jeff

jp
Go to Top of Page

xequte

38610 Posts

Posted - Feb 04 2016 :  17:03:04  Show Profile  Reply
Hi Jeff

You did not attach the image. Is it a 1bit (black and white) image?

What version of ImageEn are you using?



Nigel
Xequte Software
www.xequte.com
nigel@xequte.com
Go to Top of Page

jeffp

USA
42 Posts

Posted - Feb 09 2016 :  20:50:45  Show Profile  Reply
Yes it is a 1 bit image and I am on the latest build of ImageEn.

Here is the image again.

attach/jeffp/201629205036_Test.zip
20.64 KB

jp
Go to Top of Page

xequte

38610 Posts

Posted - Feb 11 2016 :  19:43:44  Show Profile  Reply
Hi Jeff

The image is 1bit, i.e. it only has pure white and pure black, so contrast should have no effect. So the question is why is the preview showing one? This is due to the use of a quality filter in the preview window.

Nigel
Xequte Software
www.xequte.com
nigel@xequte.com
Go to Top of Page

jeffp

USA
42 Posts

Posted - Feb 22 2016 :  09:34:04  Show Profile  Reply
Just checking up on this issue. Are you saying that there are certain edits in the Preview window that shouldn't be applicable to black and white images?

Will there be a resolution for this in the next build?

--Jeff

jp
Go to Top of Page

xequte

38610 Posts

Posted - Feb 22 2016 :  17:24:33  Show Profile  Reply
Hi Jeff

Effects that try to change the color range will have no effect with black and white images, because you cannot stretch on/off.

The reason you are seeing a change in the preview dialog is because a quality filter is being used in the Preview dialog that converts the image to shades of gray. See your settings for IEGlobalSettings().DefaultPreviewsZoomFilter (and IEGlobalSettings().DefaultResampleFilter). Naturally, a gray scale image can be stretched.

You can test this executing this:

imageenview1.io.loadfromfile('Test.tif');
imageenview1.proc.ConvertTo24Bit();
imageenview1.Proc.Resample(200, -1, rfTriangle);  // <- replacing rfTriangle with rfNone the subsequent proc.Contrast has no effect
imageenview1.proc.Contrast(100);


Generally none of the ppeColorAdjust effects are appropriate for 1bit images. I will add this to the documentation.


Nigel
Xequte Software
www.xequte.com
nigel@xequte.com
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: