Just a little background. After I have the photos rotated, I am trying to update the Orientation Properties within the JPEG header. I tried using the following codes but it doesn’t seems to change anything even though the Finalize method does show as true.
Here are my codes
[code] dim dpath as folderitem
dpath = getfolderitem(filename,folderitem.pathtypeshell)
dim c as new cgimagesourcembs(dpath)
dim img as cgimagembs = c.createimageatindex(0)
dim globalprop as dictionary = c.properties
dim p as Dictionary = c.PropertiesAtIndex(0)
dim d as new CGImageDestinationMBS(dpath,“public.jpeg”,1)
I am not sure where I went wrong. In the debug, the Orientation did change within the Dictionary and the d.Finalize did show it works but the actual Header information did not change as reported by Preview.
I hope someone can help point the right direction. Thank you so much.
[code] // files
dim dpath as folderitem = SpecialFolder.Desktop.Child(“test.jpg”)
dim opath as folderitem = dpath.parent.Child(“output.jpg”)
// open source
dim imageSource as new cgimagesourcembs(dpath)
// read image
dim img as cgimagembs = imageSource.createimageatindex(0)
// global properties
dim globalprop as dictionary = imageSource.properties
// per image properties
dim p as Dictionary = imageSource.PropertiesAtIndex(0)
dim imageDest as new CGImageDestinationMBS(opath,“public.jpeg”,1)
'const orientation = 1 // top left
const orientation = 3 // bottom right
// set globals
imageDest.SetPropertiesCF(globalprop)
// now set new orientation
p.value(imageDest.kCGImageDestinationOrientation) = orientation
p.value(imageDest.kCGImageDestinationMergeMetadata) = true
// change tiff dictionary, if present
dim dTIFF as Dictionary = p.lookup(imageSource.kCGImagePropertyTIFFDictionary, nil)
if dTIFF <> nil then
dTIFF.value(imageSource.kCGImagePropertyTIFFOrientation) = orientation
end if
// change iptc dictionary, if present
dim dIPTC as Dictionary = p.lookup(imageSource.kCGImagePropertyIPTCDictionary, nil)
if dIPTC <> nil then
dIPTC.value(imageSource.kCGImagePropertyIPTCImageOrientation) = orientation
end if
// write out image
imageDest.AddImage(img,p)
call imageDest.Finalize[/code]
Your search - exif site:monkeybread.net - did not match any documents.
Suggestions:
Make sure all words are spelled correctly.
Try different keywords.
Try more general keywords.
Try fewer keywords.
Ad
Online EXIF Viewer? Adwww.urbanbird.io/editor?
View and Edit the metadata of your pictures.
I am sorry, but this is useless.
What I need is a way to set the content of the Copyright Status and Copyright notice fields of a picture. Is it possible with MBS plugins ?
[quote=341024:@Christian Schmitz]The search field on monkeybread.net search that site.
You want to search monkeybreadsoftware.net, please search with that domain.[/quote]
why would monkeybread.net redirect to a Dynapdf specific one and the other not ?
Visually the two look so similar I also find this confusing that there’s any difference
I did use the CGImage but the file size of my JPEG files dropped by about 1mb when I change the EXIF tags. In the end for my app, I ended up just using EXIFTool via Shell to make the EXIF change.
I did use the CGImage but the file size of my JPEG files dropped by about 1mb when I change the EXIF tags. In the end for my app, I ended up just using EXIFTool via Shell to make the EXIF change.
Are you altering the actual image or simply updating the meta data?
The code I’ve seen posted here reads the image in (decompressing it) and then writes it back out again (recompression). You need to use the function CGImageDestinationCopyImageSource to avoid re-processing the image data.
[quote=341214:@Sam Rowlands]Are you altering the actual image or simply updating the meta data?
The code I’ve seen posted here reads the image in (decompressing it) and then writes it back out again (recompression). You need to use the function CGImageDestinationCopyImageSource to avoid re-processing the image data.[/quote]
Ah, I don’t see the function in CGImageDestinationMBS. Anyways, ExifTool in this instance does the job nicely which did not strip off some custom EXIF tags.
Which is good to know; while the TIFF guidelines (yes the TIFF spec is used for image meta data) say that apps should always preserve the meta data even if they don’t understand it. But it appears the no-one follows the guidelines.
It kinda pisses me off as I developed a non-destructive file format based upon the TIFF spec and it was fecking awesome IMHO. Alas no other application followed the TIFF guidelines and would break this format as soon as they saved. Basically the format contained two images, the original and the modified version. Most applications (including Adobe’s own apps and they developed the spec) would overwrite the file with only one image instead of two and strip off the custom meta data that my application used.