ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 ioJPEG_AUTOCALC / Scaling do they work allright?

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

View 
UserName:
Password:
Format  Bold Italicized Underline  Align Left Centered Align Right  Horizontal Rule  Insert Hyperlink   Browse for an image to attach to your post Browse for a zip to attach to your post Insert Code  Insert Quote Insert List
   
Message 

 

Emoji
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Black Eye [B)]
Frown [:(] Shocked [:0] Angry [:(!] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
daansi Posted - Feb 11 2015 : 13:11:58
Hi there,

I am using the code shown below to fill a NexusDB Table connected to a DevExpress QuantumGrid - CardView.
Scrolling through the Grid executes at an amazing speed (Picasa / Lightroom 5 compatible).
However scrolling slows down significantly at some records. Looking more closely at these records I noticed that they were all jpegs without an EXIF_Bitmap.
So for these records the second part of the code is executed. To check their actual size I saved the Image directly from the CardView to disc. These images were much larger then one would expect from a 160X160 pixel image.
I am quite sure that the code is correct. So I am suspecting that the scaling and loading do not work correctly as they should.


    try
      if Assigned(ImageViewer_1.IO.Params.EXIF_Bitmap) then
      begin
        //Load just the EXIF_Bitmap into ImageEnView1
        ImageViewer_1.IO.Params.GetThumbnail := True;
        ImageViewer_1.IO.LoadFromFile(aFile);
      end
      else
      //If Not EXIF-Thumb exists then read reduced size of original Picture
      begin
        ImageViewer_1.IO.Params.Width  := 160;
        ImageViewer_1.IO.Params.Height := 160;
        ImageViewer_1.IO.Params.JPEG_Scale := ioJPEG_AUTOCALC;
//        ImageViewer_1.IO.Params.JPEG_DCTMethod := ioJPEG_IFAST;
        ImageViewer_1.IO.Params.EnableAdjustOrientation := True;
        ImageViewer_1.IO.LoadFromFile(aFile);
      end;
    finally
      Field := TBlobField(tPictures.FieldByName('Thumb'));
      Stream := tPictures.CreateBlobStream(Field, bmWrite);
      ImageViewer_1.IO.SaveToStream(Stream,ioJPEG);
      ImageViewer_1.IO.CloseMediaFile;
      Stream.Free;
    end;
4   L A T E S T    R E P L I E S    (Newest First)
daansi Posted - Feb 13 2015 : 08:00:32
Hi Nigel,

Really awesome, just beat Picasa scrolling through thousands of photos.
Resampling was not necessary after loading, I used IELoadAsThumbnail directly to load the image from disc into the Database.

Cheers, Daan
xequte Posted - Feb 12 2015 : 18:17:54
Hi Daan

That is not the way ioJPEG_AUTOCALC works, in fact if you set width and height to 160x160, then the image is guaranteed to be larger than this.

If you want the image to be 160x160 you should resample it after loading. You might want to look at IELoadAsThumbnail:

http://www.imageen.com/help/TBitmap.IELoadAsThumbnail.html

Nigel
Xequte Software
www.xequte.com
nigel@xequte.com
daansi Posted - Feb 12 2015 : 03:57:13
Hi Nigel,

Thanks for your quick reply. I checked that already, thanks.
But my point remains: when setting width and height to 160X160, you expect that the image read into the datbasefield will not exceed these measures.
When I add a button excuting ImageEnView1.Proc.DoPreviews(ppeEffects) in your IPTC demo and look at the Resize tab I see sizes like (648X432) which is indeed One_Eighth of the original but that is not what you expect when you set the dimensions 160X160.
With thousands of photos the database will grow unnecessarily.
Helas many photos still not contain EXIF_Thumbs - which are read smoothly in very small sizes into the table.
So is there a way to set the scale of the image exactly to the desired dimensions before actually loading the image?

Thanks in advance Daan
xequte Posted - Feb 11 2015 : 14:39:38
Hi

That code looks fine. Did you check JPEG_Scale_Used after loading to ensure it worked correctly?

http://www.imageen.com/help/TIOParamsVals.JPEG_Scale_Used.html

Nigel
Xequte Software
www.xequte.com
nigel@xequte.com