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
 How to update thumbnail with the main image

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
paul Posted - Oct 15 2020 : 04:38:23
Hi All,

I am using the code below to crop an image and then to resize the image. This is working fine. The only issue I have is it doesn't seem to update the thumbnail. I ran the code and then checked the images in windows explorer. At first I didn't think it had worked, as all the images were the same. But when I opened the image, it was cropped and resized correctly.

How do I make sure the thumbnail is also updated?

Thanks,
Paul

// imgDest is a TImageEnView


    //crop and resize file
    Crop_Margin := eSize.Value;
    imgRect := imgDest.Proc.AutoCrop( 0, clWhite, False );
    imgDest.Proc.Crop( max( imgRect.Left - Crop_Margin, 0 ),
                    max( imgRect.Top - Crop_Margin, 0 ),
                    min( imgRect.Right + Crop_Margin, imgDest.IEBitmap.Width ),
                    min( imgRect.Bottom + Crop_Margin, imgDest.IEBitmap.Height ) );

    w := FltToInt(eWidth.Value);
    h := FltToInt(eHeight.Value);
    if eFilter.Itemindex <> -1 then begin
      if (w > 0) and (h > 0) then begin
        imgDest.Proc.Resample(w, h, TResampleFilter(eFilter.Itemindex));
      end;
    end;

    // save destination file
    imgDest.IO.SaveToFile(outFile);
2   L A T E S T    R E P L I E S    (Newest First)
whisper1980 Posted - May 11 2021 : 12:52:54
A little late, but might help others. This worked for me using Delphi 10.4.2:
SHChangeNotify(SHCNE_UPDATEITEM, SHCNF_PATHW or SHCNF_FLUSH, Pointer(fImageFilename), nil);

Where fImageFilename is a string and is the path to the jpg file I had just edited.

Eric
xequte Posted - Oct 15 2020 : 15:47:30
Hi

You may need to force windows to refresh the thumbnail with
SHChangeNotify:

https://stackoverflow.com/questions/61200815/update-image-thumbnail-from-c-sharp
https://docs.microsoft.com/en-us/windows/win32/api/shlobj_core/nf-shlobj_core-shchangenotify

The other possibility is that the image contains a thumbnail and Windows is using that. So you should update the thumbnail:

https://www.imageen.com/help/TIOParams.EXIF_Bitmap.html
https://www.imageen.com/help/TIOParams.UpdateEXIFThumbnail.html

Nigel
Xequte Software
www.imageen.com