Jump to content

Resize Image and Retain the Exif data


b0x4it
 Share

Recommended Posts

I am using _GDIPlus_ImageResize to resize an image, but it remove all the exif data! is there anyway to retain the metadata of an image?

#include <GDIPlus.au3>
Global $hBitmap, $hImage, $hImage_new, $sCLSID, $tData, $tParams
_GDIPlus_StartUp()
$hImage = _GDIPlus_ImageLoadFromFile("c:\CAM00879.jpg")
$hImage = _GDIPlus_ImageResize($hImage, 100, 80) ;resize image
_GDIPlus_ImageSaveToFile($hImage_new, "c:\AutoItImage2.jpg")
_GDIPlus_ImageDispose($hImage)
_GDIPlus_ShutDown()
Link to comment
Share on other sites

That's not possible because as mentioned in your previous post the _GDIPlus_ImageResize() will create a new bitmap in the memory which is not in JPG format.

You have to save all the JPG meta data create the new JPG and update the new JPG with the meta data.

Btw, do not use same variable ($hImage) for different image handles! It will cause memory leaks!

Br,

UEZ

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Link to comment
Share on other sites

That's not possible because as mentioned in your previous post the _GDIPlus_ImageResize() will create a new bitmap in the memory which is not in JPG format.

You have to save all the JPG meta data create the new JPG and update the new JPG with the meta data.

Btw, do not use same variable ($hImage) for different image handles! It will cause memory leaks!

Br,

UEZ

 

Thanks for your quick reply. Could you please give me the name of the function or method to get and set metadatas of an image?

Thanks for your advice, I though it make the code faster because it does not need to allocate another portion of memory! 

Link to comment
Share on other sites

 

Thanks for the link, but it doesn't have any information about shutter, iso, exposure, flash, and etc. Do you know of any third party app with command line parameters so that I can use autoit to automate this process? I know that Faststone can do this, but it doesn't have command line AFAIK. I also tried ImageMagik, but it doesn't retain the metadata!

Link to comment
Share on other sites

I'm not working with EXIF stuff but you can try these tools: http://www.hugsan.com/exifutils/html/features.html

 

Br,

UEZ

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...