SaveImage and metadata
Posted: Sat Oct 02, 2010 8:15 pm
JPEG and TIFF files can store metadata. So does the embryonic WebP format. PNG can also hold metadata (although it's not standardised).
I wonder if PB's SaveImage() command could be enhanced to pack metadata into an image file?
There could be a native structure with many possible fields (copyright, author, dates, subject etc.) and PB would pack in whatever fields the target format accepts. When calling SaveImage, an optional pointer to the structure could be included.
I personally would find this very useful.
Aside from the obvious benefit (metadata in PB-saved images), this would also mean we'd have a standard PB metadata structure. This structure could be used by library-writers when they write saving procedures for other formats (for example, I could use it in PureSVG). The structure could also have audio and video fields for people writing programs that save those kinds of files. (If PB ever has SaveVideo() or SaveAudio() commands, they could refer to the structure too.)
LoadImage() could also be enhanced with an optional pointer to a metadata structure. If the pointer<>0 and the loaded image contains metadata, it gets piped into that structure.
I hope the PB team consider this.
I wonder if PB's SaveImage() command could be enhanced to pack metadata into an image file?
There could be a native structure with many possible fields (copyright, author, dates, subject etc.) and PB would pack in whatever fields the target format accepts. When calling SaveImage, an optional pointer to the structure could be included.
Code: Select all
NativeStructure PB_Metadata
Title.s
Artist.s
Copyright.s
CreationDate.i
DigitizationDate.i
PublishedDate.i
Location.s
etc. etc. etc.
EndStructure
img = CreateImage(#PB_Any,100,100)
md.PB_MetaData
md\Title = "My image"
md\Author = "Seymour Clufley"
md\PublishedDate = Date(2010,10,2)
SaveImage(img,"C:\myimage.webp",#PB_ImagePlugin_WebP,@md)
Aside from the obvious benefit (metadata in PB-saved images), this would also mean we'd have a standard PB metadata structure. This structure could be used by library-writers when they write saving procedures for other formats (for example, I could use it in PureSVG). The structure could also have audio and video fields for people writing programs that save those kinds of files. (If PB ever has SaveVideo() or SaveAudio() commands, they could refer to the structure too.)
LoadImage() could also be enhanced with an optional pointer to a metadata structure. If the pointer<>0 and the loaded image contains metadata, it gets piped into that structure.
I hope the PB team consider this.