commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jonah <jo...@nucleussystems.com>
Subject [sanselan] Copy/Resize Image
Date Fri, 11 Mar 2011 23:56:32 GMT
Hello, world!

My project involves resizing images.  I need to keep the EXIF metadata
though.  I wrote a bit of code* that copies EXIF data from the original
image to the resized one, but it instead copies the entire image, not
just the metadata.

So I need either

1.  A way to copy _only_ the metadata between images, or
2.  A way to read the whole image with Sanselan, manipulate the image
data, and then write the whole thing, metadata and all, to a new file.

I haven't been able to find a solution reading any documentation I could
find, tutorials, or the sample code.  Thanks!


* Code here:
try {
	IImageMetadata metadata = Sanselan.getMetadata(original);
	JpegImageMetadata jpegMetadata = (JpegImageMetadata) metadata;
	if (jpegMetadata != null) {
		TiffImageMetadata exif = jpegMetadata.getExif();
		if (exif != null) {
			TiffOutputSet outputSet = exif.getOutputSet();
			OutputStream outputStream = new BufferedOutputStream(new
FileOutputStream(copy));
			new ExifRewriter().updateExifMetadataLossless(original, outputStream,
outputSet);
			outputStream.close();
// ...


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org


Mime
View raw message