incubator-sanselan-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cmc...@apache.org
Subject svn commit: r703730 - in /incubator/sanselan/trunk/src: main/java/org/apache/sanselan/ main/java/org/apache/sanselan/common/ main/java/org/apache/sanselan/common/mylzw/ main/java/org/apache/sanselan/formats/bmp/pixelparsers/ main/java/org/apache/sansel...
Date Sat, 11 Oct 2008 20:53:41 GMT
Author: cmchen
Date: Sat Oct 11 13:53:40 2008
New Revision: 703730

URL: http://svn.apache.org/viewvc?rev=703730&view=rev
Log:
More progress on the JPEG IPTC Photoshop metadata support.

Modified:
    incubator/sanselan/trunk/src/main/java/org/apache/sanselan/ColorTools.java
    incubator/sanselan/trunk/src/main/java/org/apache/sanselan/common/BinaryFileFunctions.java
    incubator/sanselan/trunk/src/main/java/org/apache/sanselan/common/RgbBufferedImageFactory.java
    incubator/sanselan/trunk/src/main/java/org/apache/sanselan/common/SimpleBufferedImageFactory.java
    incubator/sanselan/trunk/src/main/java/org/apache/sanselan/common/mylzw/MyLZWDecompressor.java
    incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/bmp/pixelparsers/PixelParserSimple.java
    incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/gif/GifImageParser.java
    incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/jpeg/JpegConstants.java
    incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/jpeg/JpegImageParser.java
    incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/jpeg/iptc/IPTCBlock.java
    incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/jpeg/iptc/IPTCConstants.java
    incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/jpeg/iptc/IPTCParser.java
    incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/jpeg/iptc/IPTCRecord.java
    incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/jpeg/iptc/IPTCType.java
    incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/jpeg/iptc/IPTCTypeLookup.java
    incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/jpeg/iptc/JpegIptcRewriter.java
    incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/jpeg/iptc/PhotoshopApp13Data.java
    incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/jpeg/xmp/JpegRewriter.java
    incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/jpeg/xmp/JpegXmpRewriter.java
    incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/png/BitParser.java
    incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/png/PngText.java
    incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/png/ScanExpediter.java
    incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/png/ScanExpediterSimple.java
    incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/png/chunks/PNGChunkPLTE.java
    incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/png/chunks/PNGChunktEXt.java
    incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/png/chunks/PNGChunkzTXt.java
    incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/psd/ImageContents.java
    incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/psd/PSDHeaderInfo.java
    incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/psd/PsdImageParser.java
    incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/tiff/TiffField.java
    incubator/sanselan/trunk/src/test/java/org/apache/sanselan/SanselanTest.java
    incubator/sanselan/trunk/src/test/java/org/apache/sanselan/formats/jpeg/iptc/IptcBaseTest.java
    incubator/sanselan/trunk/src/test/java/org/apache/sanselan/formats/jpeg/iptc/IptcDumpTest.java
    incubator/sanselan/trunk/src/test/java/org/apache/sanselan/formats/jpeg/iptc/IptcUpdateTest.java

Modified: incubator/sanselan/trunk/src/main/java/org/apache/sanselan/ColorTools.java
URL: http://svn.apache.org/viewvc/incubator/sanselan/trunk/src/main/java/org/apache/sanselan/ColorTools.java?rev=703730&r1=703729&r2=703730&view=diff
==============================================================================
--- incubator/sanselan/trunk/src/main/java/org/apache/sanselan/ColorTools.java (original)
+++ incubator/sanselan/trunk/src/main/java/org/apache/sanselan/ColorTools.java Sat Oct 11 13:53:40 2008
@@ -30,10 +30,6 @@
 import java.io.File;
 import java.io.IOException;
 
-import org.apache.sanselan.common.byteSources.ByteSource;
-import org.apache.sanselan.common.byteSources.ByteSourceArray;
-import org.apache.sanselan.common.byteSources.ByteSourceFile;
-
 /**
  * This class is a mess and needs to be cleaned up.
  */

Modified: incubator/sanselan/trunk/src/main/java/org/apache/sanselan/common/BinaryFileFunctions.java
URL: http://svn.apache.org/viewvc/incubator/sanselan/trunk/src/main/java/org/apache/sanselan/common/BinaryFileFunctions.java?rev=703730&r1=703729&r2=703730&view=diff
==============================================================================
--- incubator/sanselan/trunk/src/main/java/org/apache/sanselan/common/BinaryFileFunctions.java (original)
+++ incubator/sanselan/trunk/src/main/java/org/apache/sanselan/common/BinaryFileFunctions.java Sat Oct 11 13:53:40 2008
@@ -20,7 +20,6 @@
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
-import java.io.OutputStreamWriter;
 import java.io.PrintWriter;
 import java.io.RandomAccessFile;
 

Modified: incubator/sanselan/trunk/src/main/java/org/apache/sanselan/common/RgbBufferedImageFactory.java
URL: http://svn.apache.org/viewvc/incubator/sanselan/trunk/src/main/java/org/apache/sanselan/common/RgbBufferedImageFactory.java?rev=703730&r1=703729&r2=703730&view=diff
==============================================================================
--- incubator/sanselan/trunk/src/main/java/org/apache/sanselan/common/RgbBufferedImageFactory.java (original)
+++ incubator/sanselan/trunk/src/main/java/org/apache/sanselan/common/RgbBufferedImageFactory.java Sat Oct 11 13:53:40 2008
@@ -19,8 +19,6 @@
 
 import java.awt.image.BufferedImage;
 
-import org.apache.sanselan.util.Debug;
-
 public class RgbBufferedImageFactory implements IBufferedImageFactory
 {
 	public BufferedImage getColorBufferedImage(int width, int height,

Modified: incubator/sanselan/trunk/src/main/java/org/apache/sanselan/common/SimpleBufferedImageFactory.java
URL: http://svn.apache.org/viewvc/incubator/sanselan/trunk/src/main/java/org/apache/sanselan/common/SimpleBufferedImageFactory.java?rev=703730&r1=703729&r2=703730&view=diff
==============================================================================
--- incubator/sanselan/trunk/src/main/java/org/apache/sanselan/common/SimpleBufferedImageFactory.java (original)
+++ incubator/sanselan/trunk/src/main/java/org/apache/sanselan/common/SimpleBufferedImageFactory.java Sat Oct 11 13:53:40 2008
@@ -19,8 +19,6 @@
 
 import java.awt.image.BufferedImage;
 
-import org.apache.sanselan.util.Debug;
-
 public class SimpleBufferedImageFactory implements IBufferedImageFactory
 {
 	public BufferedImage getColorBufferedImage(int width, int height,

Modified: incubator/sanselan/trunk/src/main/java/org/apache/sanselan/common/mylzw/MyLZWDecompressor.java
URL: http://svn.apache.org/viewvc/incubator/sanselan/trunk/src/main/java/org/apache/sanselan/common/mylzw/MyLZWDecompressor.java?rev=703730&r1=703729&r2=703730&view=diff
==============================================================================
--- incubator/sanselan/trunk/src/main/java/org/apache/sanselan/common/mylzw/MyLZWDecompressor.java (original)
+++ incubator/sanselan/trunk/src/main/java/org/apache/sanselan/common/mylzw/MyLZWDecompressor.java Sat Oct 11 13:53:40 2008
@@ -21,8 +21,6 @@
 import java.io.InputStream;
 import java.io.OutputStream;
 
-import org.apache.sanselan.util.Debug;
-
 public final class MyLZWDecompressor
 {
 	private static final int MAX_TABLE_SIZE = 1 << 12;

Modified: incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/bmp/pixelparsers/PixelParserSimple.java
URL: http://svn.apache.org/viewvc/incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/bmp/pixelparsers/PixelParserSimple.java?rev=703730&r1=703729&r2=703730&view=diff
==============================================================================
--- incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/bmp/pixelparsers/PixelParserSimple.java (original)
+++ incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/bmp/pixelparsers/PixelParserSimple.java Sat Oct 11 13:53:40 2008
@@ -17,7 +17,6 @@
 package org.apache.sanselan.formats.bmp.pixelparsers;
 
 import java.awt.image.BufferedImage;
-import java.awt.image.DataBuffer;
 import java.io.IOException;
 
 import org.apache.sanselan.ImageReadException;

Modified: incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/gif/GifImageParser.java
URL: http://svn.apache.org/viewvc/incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/gif/GifImageParser.java?rev=703730&r1=703729&r2=703730&view=diff
==============================================================================
--- incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/gif/GifImageParser.java (original)
+++ incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/gif/GifImageParser.java Sat Oct 11 13:53:40 2008
@@ -42,7 +42,6 @@
 import org.apache.sanselan.common.byteSources.ByteSource;
 import org.apache.sanselan.common.mylzw.MyLZWCompressor;
 import org.apache.sanselan.common.mylzw.MyLZWDecompressor;
-import org.apache.sanselan.formats.tiff.write.TiffOutputField;
 import org.apache.sanselan.palette.Palette;
 import org.apache.sanselan.palette.PaletteFactory;
 import org.apache.sanselan.util.Debug;

Modified: incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/jpeg/JpegConstants.java
URL: http://svn.apache.org/viewvc/incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/jpeg/JpegConstants.java?rev=703730&r1=703729&r2=703730&view=diff
==============================================================================
--- incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/jpeg/JpegConstants.java (original)
+++ incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/jpeg/JpegConstants.java Sat Oct 11 13:53:40 2008
@@ -16,27 +16,31 @@
  */
 package org.apache.sanselan.formats.jpeg;
 
-import org.apache.sanselan.formats.jpeg.iptc.IPTCType;
-
-
-public interface JpegConstants {
+public interface JpegConstants
+{
 	public static final int MAX_SEGMENT_SIZE = 0xffff;
 
-	public static final byte JFIF0_SIGNATURE[] = new byte[] { 0x4a, // J
+	public static final byte JFIF0_SIGNATURE[] = new byte[] { //
+	0x4a, // J
 			0x46, // F
 			0x49, // I
 			0x46, // F
 			0x0, //  
 	};
-	public static final byte JFIF0_SIGNATURE_ALTERNATIVE[] = new byte[] { 0x4a, // J
+	public static final byte JFIF0_SIGNATURE_ALTERNATIVE[] = new byte[] { //
+	0x4a, // J
 			0x46, // F
 			0x49, // I
 			0x46, // F
 			0x20, //  
 	};
 
-	public static final byte EXIF_IDENTIFIER_CODE[] = { 0xff & 'E', 0xff & 'x',
-			0xff & 'i', 0xff & 'f', };
+	public static final byte EXIF_IDENTIFIER_CODE[] = { //
+	0x45, // E
+			0x78, // x
+			0x69, // i
+			0x66, // f
+	};
 
 	public static final byte XMP_IDENTIFIER[] = { //
 	0x68, // h
@@ -115,15 +119,26 @@
 	public static final byte icc_profile_label[] = { 0x49, 0x43, 0x43, 0x5F,
 			0x50, 0x52, 0x4F, 0x46, 0x49, 0x4C, 0x45, 0x0 };
 
-	// public static final byte PhotoshopIdentificationString[] =
-	// "Photoshop 3.0"
-	// .getBytes();
-	public static final byte PhotoshopIdentificationString[] = { 0xff & 'P',
-			0xff & 'h', 0xff & 'o', 0xff & 't', 0xff & 'o', 0xff & 's',
-			0xff & 'h', 0xff & 'o', 0xff & 'p', 0xff & ' ', 0xff & '3',
-			0xff & '.', 0xff & '0', 0, };
-	public static final byte CONST_8BIM[] = { 0xff & '8', 0xff & 'B',
-			0xff & 'I', 0xff & 'M', };
-
+	public static final byte PHOTOSHOP_IDENTIFICATION_STRING[] = { //
+	0x50, // P
+			0x68, // h
+			0x6F, // o
+			0x74, // t
+			0x6F, // o
+			0x73, // s
+			0x68, // h
+			0x6F, // o
+			0x70, // p
+			0x20, //
+			0x33, // 3
+			0x2E, // .
+			0x30, // 0
+	};
+	public static final byte CONST_8BIM[] = { //
+	0x38, // 8
+			0x42, // B
+			0x49, // I
+			0x4D, // M
+	};
 
 }

Modified: incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/jpeg/JpegImageParser.java
URL: http://svn.apache.org/viewvc/incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/jpeg/JpegImageParser.java?rev=703730&r1=703729&r2=703730&view=diff
==============================================================================
--- incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/jpeg/JpegImageParser.java (original)
+++ incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/jpeg/JpegImageParser.java Sat Oct 11 13:53:40 2008
@@ -34,7 +34,6 @@
 import org.apache.sanselan.ImageReadException;
 import org.apache.sanselan.common.IImageMetadata;
 import org.apache.sanselan.common.byteSources.ByteSource;
-import org.apache.sanselan.formats.jpeg.iptc.IPTCRecord;
 import org.apache.sanselan.formats.jpeg.iptc.IPTCParser;
 import org.apache.sanselan.formats.jpeg.iptc.PhotoshopApp13Data;
 import org.apache.sanselan.formats.jpeg.segments.App13Segment;

Modified: incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/jpeg/iptc/IPTCBlock.java
URL: http://svn.apache.org/viewvc/incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/jpeg/iptc/IPTCBlock.java?rev=703730&r1=703729&r2=703730&view=diff
==============================================================================
--- incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/jpeg/iptc/IPTCBlock.java (original)
+++ incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/jpeg/iptc/IPTCBlock.java Sat Oct 11 13:53:40 2008
@@ -3,6 +3,9 @@
  */
 package org.apache.sanselan.formats.jpeg.iptc;
 
+/*
+ * Represents an IPTC block, a set of key-value pairs of Photoshop IPTC data.
+ */
 public class IPTCBlock
 {
 	public final int blockType;

Modified: incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/jpeg/iptc/IPTCConstants.java
URL: http://svn.apache.org/viewvc/incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/jpeg/iptc/IPTCConstants.java?rev=703730&r1=703729&r2=703730&view=diff
==============================================================================
--- incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/jpeg/iptc/IPTCConstants.java (original)
+++ incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/jpeg/iptc/IPTCConstants.java Sat Oct 11 13:53:40 2008
@@ -16,24 +16,15 @@
  */
 package org.apache.sanselan.formats.jpeg.iptc;
 
-public interface IPTCConstants
-{
+import org.apache.sanselan.formats.jpeg.JpegConstants;
 
-	// public static final byte PhotoshopIdentificationString[] =
-	// "Photoshop 3.0"
-	// .getBytes();
-	public static final byte PHOTOSHOP_IDENTIFICATION_STRING[] = { 0xff & 'P',
-			0xff & 'h', 0xff & 'o', 0xff & 't', 0xff & 'o', 0xff & 's',
-			0xff & 'h', 0xff & 'o', 0xff & 'p', 0xff & ' ', 0xff & '3',
-			0xff & '.', 0xff & '0', 0, };
-	public static final byte CONST_8BIM[] = { 0xff & '8', 0xff & 'B',
-			0xff & 'I', 0xff & 'M', };
+public interface IPTCConstants extends JpegConstants
+{
 
-	public static final byte IPTCPrefix[] = { 0x1C, 0x02, };
+	public static final byte IPTC_PREFIX[] = { 0x1C, 0x02, };
 
-	
 	public static final int IPTC_NON_EXTENDED_RECORD_MAXIMUM_SIZE = 32767;
-	
+
 	public static final int IMAGE_RESOURCE_BLOCK_PHOTOSHOP2_INFO = 0x03e8;
 	public static final int IMAGE_RESOURCE_BLOCK_MACINTOSH_PRINT_INFO = 0x03e9;
 	public static final int IMAGE_RESOURCE_BLOCK_XML_DATA = 0x03ea;
@@ -99,90 +90,90 @@
 	public static final int IMAGE_RESOURCE_BLOCK_CLIPPING_PATH_NAME = 0x0bb7;
 	public static final int IMAGE_RESOURCE_BLOCK_PRINT_FLAGS_INFO = 0x2710;
 
-//	public static final int IPTC_RECORD_PREFIX = 0x1c02;
+	// public static final int IPTC_RECORD_PREFIX = 0x1c02;
 	public static final int IPTC_RECORD_TAG_MARKER = 0x1c;
 	public static final int IPTC_ENVELOPE_RECORD_NUMBER = 0x01;
 	public static final int IPTC_APPLICATION_2_RECORD_NUMBER = 0x02;
 
 	public static final IPTCType IPTC_TYPE_RECORD_VERSION = new IPTCType(0,
-			"RecordVersion");
+			"Record Version");
 	public static final IPTCType IPTC_TYPE_OBJECT_TYPE_REFERENCE = new IPTCType(
-			3, "ObjectTypeReference");
+			3, "Object Type Reference");
 	public static final IPTCType IPTC_TYPE_OBJECT_ATTRIBUTE_REFERENCE = new IPTCType(
-			4, "ObjectAttributeReference");
+			4, "Object Attribute Reference");
 	public static final IPTCType IPTC_TYPE_OBJECT_NAME = new IPTCType(5,
-			"ObjectName");
+			"Object Name");
 	public static final IPTCType IPTC_TYPE_EDIT_STATUS = new IPTCType(7,
-			"EditStatus");
+			"Edit Status");
 	public static final IPTCType IPTC_TYPE_EDITORIAL_UPDATE = new IPTCType(8,
-			"EditorialUpdate");
+			"Editorial Update");
 	public static final IPTCType IPTC_TYPE_URGENCY = new IPTCType(10, "Urgency");
 	public static final IPTCType IPTC_TYPE_SUBJECT_REFERENCE = new IPTCType(12,
-			"SubjectReference");
+			"Subject Reference");
 	public static final IPTCType IPTC_TYPE_CATEGORY = new IPTCType(15,
 			"Category");
 	public static final IPTCType IPTC_TYPE_SUPPLEMENTAL_CATEGORY = new IPTCType(
-			20, "SupplementalCategory");
+			20, "Supplemental Category");
 	public static final IPTCType IPTC_TYPE_FIXTURE_IDENTIFIER = new IPTCType(
-			22, "FixtureIdentifier");
+			22, "Fixture Identifier");
 	public static final IPTCType IPTC_TYPE_KEYWORDS = new IPTCType(25,
 			"Keywords");
 	public static final IPTCType IPTC_TYPE_CONTENT_LOCATION_CODE = new IPTCType(
-			26, "ContentLocationCode");
+			26, "Content Location Code");
 	public static final IPTCType IPTC_TYPE_CONTENT_LOCATION_NAME = new IPTCType(
-			27, "ContentLocationName");
+			27, "Content Location Name");
 	public static final IPTCType IPTC_TYPE_RELEASE_DATE = new IPTCType(30,
-			"ReleaseDate");
+			"Release Date");
 	public static final IPTCType IPTC_TYPE_RELEASE_TIME = new IPTCType(35,
-			"ReleaseTime");
+			"Release Time");
 	public static final IPTCType IPTC_TYPE_EXPIRATION_DATE = new IPTCType(37,
-			"ExpirationDate");
+			"Expiration Date");
 	public static final IPTCType IPTC_TYPE_EXPIRATION_TIME = new IPTCType(38,
-			"ExpirationTime");
+			"Expiration Time");
 	public static final IPTCType IPTC_TYPE_SPECIAL_INSTRUCTIONS = new IPTCType(
-			40, "SpecialInstructions");
+			40, "Special Instructions");
 	public static final IPTCType IPTC_TYPE_ACTION_ADVISED = new IPTCType(42,
-			"ActionAdvised");
+			"Action Advised");
 	public static final IPTCType IPTC_TYPE_REFERENCE_SERVICE = new IPTCType(45,
-			"ReferenceService");
+			"Reference Service");
 	public static final IPTCType IPTC_TYPE_REFERENCE_DATE = new IPTCType(47,
-			"ReferenceDate");
+			"Reference Date");
 	public static final IPTCType IPTC_TYPE_REFERENCE_NUMBER = new IPTCType(50,
-			"ReferenceNumber");
+			"Reference Number");
 	public static final IPTCType IPTC_TYPE_DATE_CREATED = new IPTCType(55,
-			"DateCreated");
+			"Date Created");
 	public static final IPTCType IPTC_TYPE_TIME_CREATED = new IPTCType(60,
-			"TimeCreated");
+			"Time Created");
 	public static final IPTCType IPTC_TYPE_DIGITAL_CREATION_DATE = new IPTCType(
-			62, "DigitalCreationDate");
+			62, "Digital Creation Date");
 	public static final IPTCType IPTC_TYPE_DIGITAL_CREATION_TIME = new IPTCType(
-			63, "DigitalCreationTime");
+			63, "Digital Creation Time");
 	public static final IPTCType IPTC_TYPE_ORIGINATING_PROGRAM = new IPTCType(
-			65, "OriginatingProgram");
+			65, "Originating Program");
 	public static final IPTCType IPTC_TYPE_PROGRAM_VERSION = new IPTCType(70,
-			"ProgramVersion");
+			"Program Version");
 	public static final IPTCType IPTC_TYPE_OBJECT_CYCLE = new IPTCType(75,
-			"ObjectCycle");
+			"Object Cycle");
 	public static final IPTCType IPTC_TYPE_BYLINE = new IPTCType(80, "By-line");
 	public static final IPTCType IPTC_TYPE_BYLINE_TITLE = new IPTCType(85,
-			"By-lineTitle");
+			"By-line Title");
 	public static final IPTCType IPTC_TYPE_CITY = new IPTCType(90, "City");
 	public static final IPTCType IPTC_TYPE_SUBLOCATION = new IPTCType(92,
 			"Sublocation");
 	public static final IPTCType IPTC_TYPE_PROVINCE_STATE = new IPTCType(95,
 			"Province/State");
 	public static final IPTCType IPTC_TYPE_COUNTRY_PRIMARY_LOCATION_CODE = new IPTCType(
-			100, "Country/PrimaryLocationCode");
+			100, "Country/Primary Location Code");
 	public static final IPTCType IPTC_TYPE_COUNTRY_PRIMARY_LOCATION_NAME = new IPTCType(
-			101, "Country/PrimaryLocationName");
+			101, "Country/Primary Location Name");
 	public static final IPTCType IPTC_TYPE_ORIGINAL_TRANSMISSION_REFERENCE = new IPTCType(
-			103, "OriginalTransmission,Reference");
+			103, "Original Transmission, Reference");
 	public static final IPTCType IPTC_TYPE_HEADLINE = new IPTCType(105,
 			"Headline");
 	public static final IPTCType IPTC_TYPE_CREDIT = new IPTCType(110, "Credit");
 	public static final IPTCType IPTC_TYPE_SOURCE = new IPTCType(115, "Source");
 	public static final IPTCType IPTC_TYPE_COPYRIGHT_NOTICE = new IPTCType(116,
-			"CopyrightNotice");
+			"Copyright Notice");
 	public static final IPTCType IPTC_TYPE_CONTACT = new IPTCType(118,
 			"Contact");
 	public static final IPTCType IPTC_TYPE_CAPTION_ABSTRACT = new IPTCType(120,
@@ -190,29 +181,29 @@
 	public static final IPTCType IPTC_TYPE_WRITER_EDITOR = new IPTCType(122,
 			"Writer/Editor");
 	public static final IPTCType IPTC_TYPE_RASTERIZED_CAPTION = new IPTCType(
-			125, "RasterizedCaption");
+			125, "Rasterized Caption");
 	public static final IPTCType IPTC_TYPE_IMAGE_TYPE = new IPTCType(130,
 			"ImageType");
 	public static final IPTCType IPTC_TYPE_IMAGE_ORIENTATION = new IPTCType(
-			131, "ImageOrientation");
+			131, "Image Orientation");
 	public static final IPTCType IPTC_TYPE_LANGUAGE_IDENTIFIER = new IPTCType(
-			135, "LanguageIdentifier");
+			135, "Language Identifier");
 	public static final IPTCType IPTC_TYPE_AUDIO_TYPE = new IPTCType(150,
-			"AudioType");
+			"Audio Type");
 	public static final IPTCType IPTC_TYPE_AUDIO_SAMPLING_RATE = new IPTCType(
-			151, "AudioSamplingRate");
+			151, "Audio Sampling Rate");
 	public static final IPTCType IPTC_TYPE_AUDIO_SAMPLING_RESOLUTION = new IPTCType(
-			152, "AudioSamplingResolution");
+			152, "Audio Sampling Resolution");
 	public static final IPTCType IPTC_TYPE_AUDIO_DURATION = new IPTCType(153,
-			"AudioDuration");
+			"Audio Duration");
 	public static final IPTCType IPTC_TYPE_AUDIO_OUTCUE = new IPTCType(154,
-			"AudioOutcue");
+			"Audio Outcue");
 	public static final IPTCType IPTC_TYPE_OBJECT_DATA_PREVIEW_FILE_FORMAT = new IPTCType(
-			200, "ObjectDataPreview,FileFormat");
+			200, "Object Data Preview, File Format");
 	public static final IPTCType IPTC_TYPE_OBJECT_DATA_PREVIEW_FILE_FORMAT_VERSION = new IPTCType(
-			201, "ObjectDataPreview,FileFormatVersion");
+			201, "Object Data Preview, File Format Version");
 	public static final IPTCType IPTC_TYPE_OBJECT_DATA_PREVIEW_DATA = new IPTCType(
-			202, "ObjectDataPreviewData");
+			202, "Object Data Preview Data");
 	// --
 	// public static final IPTCType IPTC_TYPE_UNKNOWN = new IPTCType(-1,
 	// "Unknown");

Modified: incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/jpeg/iptc/IPTCParser.java
URL: http://svn.apache.org/viewvc/incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/jpeg/iptc/IPTCParser.java?rev=703730&r1=703729&r2=703730&view=diff
==============================================================================
--- incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/jpeg/iptc/IPTCParser.java (original)
+++ incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/jpeg/iptc/IPTCParser.java Sat Oct 11 13:53:40 2008
@@ -45,7 +45,6 @@
 
 	public boolean isPhotoshopJpegSegment(byte segmentData[])
 	{
-
 		if (!compareByteArrays(segmentData, 0, PHOTOSHOP_IDENTIFICATION_STRING,
 				0, PHOTOSHOP_IDENTIFICATION_STRING.length))
 			return false;
@@ -200,10 +199,9 @@
 					recordSize);
 			index += recordSize;
 
+			// Debug.debug("recordSize", recordSize + " (0x"
+			// + Integer.toHexString(recordSize) + ")");
 
-//			Debug.debug("recordSize", recordSize + " (0x"
-//					+ Integer.toHexString(recordSize) + ")");
-			
 			if (recordType == 0)
 			{
 				if (verbose)
@@ -392,7 +390,8 @@
 			// first, right record version record
 			bos.write(IPTC_RECORD_TAG_MARKER);
 			bos.write(IPTC_APPLICATION_2_RECORD_NUMBER);
-			bos.write(IPTC_TYPE_RECORD_VERSION.type); // record version record type.
+			bos.write(IPTC_TYPE_RECORD_VERSION.type); // record version record
+														// type.
 			bos.write2Bytes(2); // record version record size
 			bos.write2Bytes(2); // record version value
 
@@ -415,10 +414,10 @@
 			for (int i = 0; i < elements.size(); i++)
 			{
 				IPTCRecord element = (IPTCRecord) elements.get(i);
-				
-				if(element.iptcType.type == IPTC_TYPE_RECORD_VERSION.type)
+
+				if (element.iptcType.type == IPTC_TYPE_RECORD_VERSION.type)
 					continue; // ignore
-				
+
 				bos.write(IPTC_RECORD_TAG_MARKER);
 				bos.write(IPTC_APPLICATION_2_RECORD_NUMBER);
 				if (element.iptcType.type < 0 || element.iptcType.type > 0xff)
@@ -437,7 +436,7 @@
 
 			blockData = baos.toByteArray();
 		}
-		
+
 		return blockData;
 	}
 

Modified: incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/jpeg/iptc/IPTCRecord.java
URL: http://svn.apache.org/viewvc/incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/jpeg/iptc/IPTCRecord.java?rev=703730&r1=703729&r2=703730&view=diff
==============================================================================
--- incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/jpeg/iptc/IPTCRecord.java (original)
+++ incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/jpeg/iptc/IPTCRecord.java Sat Oct 11 13:53:40 2008
@@ -18,6 +18,9 @@
 
 import java.util.Comparator;
 
+/*
+ * Represents an IPTC record, a single key-value pair of Photoshop IPTC data.
+ */
 public class IPTCRecord
 {
 	public final IPTCType iptcType;

Modified: incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/jpeg/iptc/IPTCType.java
URL: http://svn.apache.org/viewvc/incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/jpeg/iptc/IPTCType.java?rev=703730&r1=703729&r2=703730&view=diff
==============================================================================
--- incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/jpeg/iptc/IPTCType.java (original)
+++ incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/jpeg/iptc/IPTCType.java Sat Oct 11 13:53:40 2008
@@ -18,19 +18,22 @@
 
 import org.apache.sanselan.formats.jpeg.JpegConstants;
 
-public class IPTCType implements JpegConstants, IPTCConstants {
+public class IPTCType implements JpegConstants, IPTCConstants
+{
 	public final int type;
 	public final String name;
 
-	public IPTCType(int type, String name) {
+	public IPTCType(int type, String name)
+	{
 		this.type = type;
 		this.name = name;
 	}
 
-	public String toString() {
+	public String toString()
+	{
 		return name + " (" + type + ")";
 	}
-	
+
 	public static IPTCType getUnknown(int type)
 	{
 		return new IPTCType(type, "Unknown");

Modified: incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/jpeg/iptc/IPTCTypeLookup.java
URL: http://svn.apache.org/viewvc/incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/jpeg/iptc/IPTCTypeLookup.java?rev=703730&r1=703729&r2=703730&view=diff
==============================================================================
--- incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/jpeg/iptc/IPTCTypeLookup.java (original)
+++ incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/jpeg/iptc/IPTCTypeLookup.java Sat Oct 11 13:53:40 2008
@@ -19,18 +19,22 @@
 import java.util.HashMap;
 import java.util.Map;
 
-public abstract class IPTCTypeLookup implements IPTCConstants {
+public abstract class IPTCTypeLookup implements IPTCConstants
+{
 
 	private static final Map IPTC_TYPE_MAP = new HashMap();
-	static {
-		for (int i = 0; i < IPTC_TYPES.length; i++) {
+	static
+	{
+		for (int i = 0; i < IPTC_TYPES.length; i++)
+		{
 			IPTCType iptcType = IPTC_TYPES[i];
 			Integer key = new Integer(iptcType.type);
 			IPTC_TYPE_MAP.put(key, iptcType);
 		}
 	}
 
-	public static final IPTCType getIptcType(int type) {
+	public static final IPTCType getIptcType(int type)
+	{
 		Integer key = new Integer(type);
 		if (!IPTC_TYPE_MAP.containsKey(key))
 			return IPTCType.getUnknown(type);

Modified: incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/jpeg/iptc/JpegIptcRewriter.java
URL: http://svn.apache.org/viewvc/incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/jpeg/iptc/JpegIptcRewriter.java?rev=703730&r1=703729&r2=703730&view=diff
==============================================================================
--- incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/jpeg/iptc/JpegIptcRewriter.java (original)
+++ incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/jpeg/iptc/JpegIptcRewriter.java Sat Oct 11 13:53:40 2008
@@ -16,7 +16,6 @@
  */
 package org.apache.sanselan.formats.jpeg.iptc;
 
-import java.io.ByteArrayOutputStream;
 import java.io.File;
 import java.io.IOException;
 import java.io.InputStream;
@@ -34,7 +33,6 @@
 import org.apache.sanselan.common.byteSources.ByteSourceFile;
 import org.apache.sanselan.common.byteSources.ByteSourceInputStream;
 import org.apache.sanselan.formats.jpeg.xmp.JpegRewriter;
-import org.apache.sanselan.util.Debug;
 
 /**
  * Interface for Exif write/update/remove functionality for Jpeg/JFIF images.
@@ -235,13 +233,13 @@
 			List newBlocks = newData.getNonIptcBlocks();
 			byte[] newBlockBytes = new IPTCParser().writeIPTCBlock(newData
 					.getRecords());
-			
+
 			int blockType = IMAGE_RESOURCE_BLOCK_IPTC_DATA;
 			byte[] blockNameBytes = new byte[0];
 			IPTCBlock newBlock = new IPTCBlock(blockType, blockNameBytes,
 					newBlockBytes);
 			newBlocks.add(newBlock);
-			
+
 			newData = new PhotoshopApp13Data(newData.getRecords(), newBlocks);
 
 			byte segmentBytes[] = new IPTCParser()

Modified: incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/jpeg/iptc/PhotoshopApp13Data.java
URL: http://svn.apache.org/viewvc/incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/jpeg/iptc/PhotoshopApp13Data.java?rev=703730&r1=703729&r2=703730&view=diff
==============================================================================
--- incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/jpeg/iptc/PhotoshopApp13Data.java (original)
+++ incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/jpeg/iptc/PhotoshopApp13Data.java Sat Oct 11 13:53:40 2008
@@ -17,21 +17,8 @@
 
 package org.apache.sanselan.formats.jpeg.iptc;
 
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
 import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Comparator;
 import java.util.List;
-import java.util.Map;
-
-import org.apache.sanselan.ImageReadException;
-import org.apache.sanselan.ImageWriteException;
-import org.apache.sanselan.SanselanConstants;
-import org.apache.sanselan.common.BinaryFileParser;
-import org.apache.sanselan.common.BinaryOutputStream;
-import org.apache.sanselan.util.Debug;
-import org.apache.sanselan.util.ParamMap;
 
 public class PhotoshopApp13Data implements IPTCConstants
 {

Modified: incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/jpeg/xmp/JpegRewriter.java
URL: http://svn.apache.org/viewvc/incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/jpeg/xmp/JpegRewriter.java?rev=703730&r1=703729&r2=703730&view=diff
==============================================================================
--- incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/jpeg/xmp/JpegRewriter.java (original)
+++ incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/jpeg/xmp/JpegRewriter.java Sat Oct 11 13:53:40 2008
@@ -318,8 +318,14 @@
 
 		List result = new ArrayList(segments);
 		if (lastAppIndex == -1)
-			throw new ImageWriteException("JPEG file has no APP segments.");
+		{
+			if(segments.size()<1)
+				throw new ImageWriteException("JPEG file has no APP segments.");
+			result.addAll(1, newSegments);
+		}
+		else
 		result.addAll(lastAppIndex + 1, newSegments);
+		
 		return result;
 	}
 

Modified: incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/jpeg/xmp/JpegXmpRewriter.java
URL: http://svn.apache.org/viewvc/incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/jpeg/xmp/JpegXmpRewriter.java?rev=703730&r1=703729&r2=703730&view=diff
==============================================================================
--- incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/jpeg/xmp/JpegXmpRewriter.java (original)
+++ incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/jpeg/xmp/JpegXmpRewriter.java Sat Oct 11 13:53:40 2008
@@ -30,7 +30,6 @@
 import org.apache.sanselan.common.byteSources.ByteSourceArray;
 import org.apache.sanselan.common.byteSources.ByteSourceFile;
 import org.apache.sanselan.common.byteSources.ByteSourceInputStream;
-import org.apache.sanselan.util.Debug;
 
 /**
  * Interface for Exif write/update/remove functionality for Jpeg/JFIF images.

Modified: incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/png/BitParser.java
URL: http://svn.apache.org/viewvc/incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/png/BitParser.java?rev=703730&r1=703729&r2=703730&view=diff
==============================================================================
--- incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/png/BitParser.java (original)
+++ incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/png/BitParser.java Sat Oct 11 13:53:40 2008
@@ -19,7 +19,6 @@
 import java.io.IOException;
 
 import org.apache.sanselan.ImageReadException;
-import org.apache.sanselan.util.Debug;
 
 public class BitParser
 {

Modified: incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/png/PngText.java
URL: http://svn.apache.org/viewvc/incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/png/PngText.java?rev=703730&r1=703729&r2=703730&view=diff
==============================================================================
--- incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/png/PngText.java (original)
+++ incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/png/PngText.java Sat Oct 11 13:53:40 2008
@@ -1,8 +1,5 @@
 package org.apache.sanselan.formats.png;
 
-import org.apache.sanselan.ImageWriteException;
-import org.apache.sanselan.SanselanException;
-import org.apache.sanselan.util.UnicodeUtils;
 
 public abstract class PngText
 {

Modified: incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/png/ScanExpediter.java
URL: http://svn.apache.org/viewvc/incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/png/ScanExpediter.java?rev=703730&r1=703729&r2=703730&view=diff
==============================================================================
--- incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/png/ScanExpediter.java (original)
+++ incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/png/ScanExpediter.java Sat Oct 11 13:53:40 2008
@@ -30,7 +30,6 @@
 import org.apache.sanselan.formats.png.scanlinefilters.ScanlineFilterSub;
 import org.apache.sanselan.formats.png.scanlinefilters.ScanlineFilterUp;
 import org.apache.sanselan.formats.transparencyfilters.TransparencyFilter;
-import org.apache.sanselan.util.Debug;
 
 public abstract class ScanExpediter extends BinaryFileParser
 {

Modified: incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/png/ScanExpediterSimple.java
URL: http://svn.apache.org/viewvc/incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/png/ScanExpediterSimple.java?rev=703730&r1=703729&r2=703730&view=diff
==============================================================================
--- incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/png/ScanExpediterSimple.java (original)
+++ incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/png/ScanExpediterSimple.java Sat Oct 11 13:53:40 2008
@@ -23,7 +23,6 @@
 import org.apache.sanselan.ImageReadException;
 import org.apache.sanselan.formats.png.chunks.PNGChunkPLTE;
 import org.apache.sanselan.formats.transparencyfilters.TransparencyFilter;
-import org.apache.sanselan.util.Debug;
 
 public class ScanExpediterSimple extends ScanExpediter
 {

Modified: incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/png/chunks/PNGChunkPLTE.java
URL: http://svn.apache.org/viewvc/incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/png/chunks/PNGChunkPLTE.java?rev=703730&r1=703729&r2=703730&view=diff
==============================================================================
--- incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/png/chunks/PNGChunkPLTE.java (original)
+++ incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/png/chunks/PNGChunkPLTE.java Sat Oct 11 13:53:40 2008
@@ -21,7 +21,6 @@
 
 import org.apache.sanselan.ImageReadException;
 import org.apache.sanselan.formats.png.GammaCorrection;
-import org.apache.sanselan.util.Debug;
 
 public class PNGChunkPLTE extends PNGChunk
 {

Modified: incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/png/chunks/PNGChunktEXt.java
URL: http://svn.apache.org/viewvc/incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/png/chunks/PNGChunktEXt.java?rev=703730&r1=703729&r2=703730&view=diff
==============================================================================
--- incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/png/chunks/PNGChunktEXt.java (original)
+++ incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/png/chunks/PNGChunktEXt.java Sat Oct 11 13:53:40 2008
@@ -19,7 +19,6 @@
 import java.io.IOException;
 
 import org.apache.sanselan.ImageReadException;
-import org.apache.sanselan.ImageWriteException;
 import org.apache.sanselan.formats.png.PngText;
 
 public class PNGChunktEXt extends PNGTextChunk

Modified: incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/png/chunks/PNGChunkzTXt.java
URL: http://svn.apache.org/viewvc/incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/png/chunks/PNGChunkzTXt.java?rev=703730&r1=703729&r2=703730&view=diff
==============================================================================
--- incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/png/chunks/PNGChunkzTXt.java (original)
+++ incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/png/chunks/PNGChunkzTXt.java Sat Oct 11 13:53:40 2008
@@ -22,7 +22,6 @@
 import org.apache.sanselan.common.ZLibUtils;
 import org.apache.sanselan.formats.png.PngConstants;
 import org.apache.sanselan.formats.png.PngText;
-import org.apache.sanselan.util.Debug;
 
 public class PNGChunkzTXt extends PNGTextChunk
 {

Modified: incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/psd/ImageContents.java
URL: http://svn.apache.org/viewvc/incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/psd/ImageContents.java?rev=703730&r1=703729&r2=703730&view=diff
==============================================================================
--- incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/psd/ImageContents.java (original)
+++ incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/psd/ImageContents.java Sat Oct 11 13:53:40 2008
@@ -16,7 +16,6 @@
  */
 package org.apache.sanselan.formats.psd;
 
-import java.io.OutputStreamWriter;
 import java.io.PrintWriter;
 
 public class ImageContents

Modified: incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/psd/PSDHeaderInfo.java
URL: http://svn.apache.org/viewvc/incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/psd/PSDHeaderInfo.java?rev=703730&r1=703729&r2=703730&view=diff
==============================================================================
--- incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/psd/PSDHeaderInfo.java (original)
+++ incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/psd/PSDHeaderInfo.java Sat Oct 11 13:53:40 2008
@@ -16,7 +16,6 @@
  */
 package org.apache.sanselan.formats.psd;
 
-import java.io.OutputStreamWriter;
 import java.io.PrintWriter;
 
 public class PSDHeaderInfo

Modified: incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/psd/PsdImageParser.java
URL: http://svn.apache.org/viewvc/incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/psd/PsdImageParser.java?rev=703730&r1=703729&r2=703730&view=diff
==============================================================================
--- incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/psd/PsdImageParser.java (original)
+++ incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/psd/PsdImageParser.java Sat Oct 11 13:53:40 2008
@@ -34,7 +34,6 @@
 import org.apache.sanselan.ImageReadException;
 import org.apache.sanselan.common.IImageMetadata;
 import org.apache.sanselan.common.byteSources.ByteSource;
-import org.apache.sanselan.formats.png.chunks.PNGChunkiTXt;
 import org.apache.sanselan.formats.psd.dataparsers.DataParser;
 import org.apache.sanselan.formats.psd.dataparsers.DataParserBitmap;
 import org.apache.sanselan.formats.psd.dataparsers.DataParserCMYK;

Modified: incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/tiff/TiffField.java
URL: http://svn.apache.org/viewvc/incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/tiff/TiffField.java?rev=703730&r1=703729&r2=703730&view=diff
==============================================================================
--- incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/tiff/TiffField.java (original)
+++ incubator/sanselan/trunk/src/main/java/org/apache/sanselan/formats/tiff/TiffField.java Sat Oct 11 13:53:40 2008
@@ -17,7 +17,6 @@
 package org.apache.sanselan.formats.tiff;
 
 import java.io.IOException;
-import java.io.OutputStreamWriter;
 import java.io.PrintWriter;
 import java.text.DateFormat;
 import java.text.SimpleDateFormat;
@@ -32,7 +31,6 @@
 import org.apache.sanselan.formats.tiff.constants.TagInfo;
 import org.apache.sanselan.formats.tiff.constants.TiffConstants;
 import org.apache.sanselan.formats.tiff.fieldtypes.FieldType;
-import org.apache.sanselan.util.Debug;
 
 public class TiffField implements TiffConstants
 {

Modified: incubator/sanselan/trunk/src/test/java/org/apache/sanselan/SanselanTest.java
URL: http://svn.apache.org/viewvc/incubator/sanselan/trunk/src/test/java/org/apache/sanselan/SanselanTest.java?rev=703730&r1=703729&r2=703730&view=diff
==============================================================================
--- incubator/sanselan/trunk/src/test/java/org/apache/sanselan/SanselanTest.java (original)
+++ incubator/sanselan/trunk/src/test/java/org/apache/sanselan/SanselanTest.java Sat Oct 11 13:53:40 2008
@@ -117,30 +117,6 @@
 		File dataFolder = new File(testFolder, "data");
 		File imagesFolder = new File(dataFolder, "images");
 
-		// imagesFolder = new File(imagesFolder,
-		// "ignore\\xml-sdk-examples\\BlueSquare.psd");
-		// imagesFolder = new File(imagesFolder,
-		// "exif\\drewNoakes\\007_Canon EOS D60.jpg");
-		// imagesFolder = new File(imagesFolder,
-		// "ignore\\PngSuite\\BGYN6A16.PNG");
-		// imagesFolder = new File(imagesFolder, "jpg\\3");
-		// imagesFolder = new File(imagesFolder, "");
-		// imagesFolder = new File(imagesFolder,
-		// "exif\\philHarvey\\Nokia\\Nokia5500.jpg");
-		// imagesFolder = new File(imagesFolder, "png\\2\\");
-		// imagesFolder = new File(imagesFolder,
-		// "exif\\drewNoakes\\007_FujiFilm FinePixS1Pro (5).jpg");
-		// imagesFolder = new File(imagesFolder,
-		// "iptc");
-		// src\\test\\data\\images\\exif\\drewNoakes\\007_Nikon D1X.jpg
-		// src\\test\\data\\images\\exif\\drewNoakes\\007_FujiFilm FinePixS1Pro
-		// (5).jpg
-		// imagesFolder = new File(imagesFolder,
-		// "exif\\drewNoakes\\007_Nikon D70.jpg");
-		// imagesFolder = new File(imagesFolder,
-		// "exif\\philHarvey\\Canon\\CanonEOS_D2000.jpg");
-		// imagesFolder = new File(imagesFolder,
-		// "exif\\philHarvey\\Motorola\\MotorolaE365.jpg");
 		// imagesFolder = new File(
 		// "C:\\work\\personal\\apache\\sanselan\\src\\test\\data\\images\\exif\\drewNoakes\\007_Canon EOS D60.jpg"
 		// );
@@ -150,6 +126,7 @@
 		// imagesFolder = new File(
 		// "C:\\work\\personal\\apache\\sanselan\\src\\test\\data\\images\\exif\\philHarvey\\Nikon\\NikonCoolpixS7.jpg"
 		// );
+//		imagesFolder = new File("C:\\work\\personal\\apache\\sanselan\\src\\test\\data\\images\\exif\\philHarvey\\UMAX\\UmaxAstraCam.jpg");
 
 		imagesFolder = imagesFolder.getAbsoluteFile();
 

Modified: incubator/sanselan/trunk/src/test/java/org/apache/sanselan/formats/jpeg/iptc/IptcBaseTest.java
URL: http://svn.apache.org/viewvc/incubator/sanselan/trunk/src/test/java/org/apache/sanselan/formats/jpeg/iptc/IptcBaseTest.java?rev=703730&r1=703729&r2=703730&view=diff
==============================================================================
--- incubator/sanselan/trunk/src/test/java/org/apache/sanselan/formats/jpeg/iptc/IptcBaseTest.java (original)
+++ incubator/sanselan/trunk/src/test/java/org/apache/sanselan/formats/jpeg/iptc/IptcBaseTest.java Sat Oct 11 13:53:40 2008
@@ -29,11 +29,6 @@
 
 public abstract class IptcBaseTest extends SanselanTest
 {
-	//	public IptcBaseTest(String name)
-	//	{
-	//		super(name);
-	//	}
-
 	protected static boolean hasIptcData(File file) throws IOException,
 			ImageReadException
 	{
@@ -45,8 +40,6 @@
 		//if (format != ImageFormat.IMAGE_FORMAT_JPEG)
 		//	return false;
 
-		//		Debug.debug("possible file", file);
-
 		try
 		{
 			ByteSource byteSource = new ByteSourceFile(file);

Modified: incubator/sanselan/trunk/src/test/java/org/apache/sanselan/formats/jpeg/iptc/IptcDumpTest.java
URL: http://svn.apache.org/viewvc/incubator/sanselan/trunk/src/test/java/org/apache/sanselan/formats/jpeg/iptc/IptcDumpTest.java?rev=703730&r1=703729&r2=703730&view=diff
==============================================================================
--- incubator/sanselan/trunk/src/test/java/org/apache/sanselan/formats/jpeg/iptc/IptcDumpTest.java (original)
+++ incubator/sanselan/trunk/src/test/java/org/apache/sanselan/formats/jpeg/iptc/IptcDumpTest.java Sat Oct 11 13:53:40 2008
@@ -26,10 +26,8 @@
 import org.apache.sanselan.ImageReadException;
 import org.apache.sanselan.ImageWriteException;
 import org.apache.sanselan.Sanselan;
-import org.apache.sanselan.common.byteSources.ByteSource;
-import org.apache.sanselan.common.byteSources.ByteSourceFile;
 import org.apache.sanselan.formats.jpeg.JpegImageMetadata;
-import org.apache.sanselan.formats.jpeg.JpegUtils;
+import org.apache.sanselan.formats.jpeg.JpegPhotoshopMetadata;
 import org.apache.sanselan.util.Debug;
 
 public class IptcDumpTest extends IptcBaseTest
@@ -57,7 +55,7 @@
 			params
 					.put(PARAM_KEY_READ_THUMBNAILS, new Boolean(
 							!ignoreImageData));
-//			params.put(PARAM_KEY_VERBOSE, Boolean.TRUE);
+			// params.put(PARAM_KEY_VERBOSE, Boolean.TRUE);
 
 			JpegImageMetadata metadata = (JpegImageMetadata) Sanselan
 					.getMetadata(imageFile, params);
@@ -66,7 +64,22 @@
 
 			metadata.getPhotoshop().dump();
 			// if(metadata.getPhotoshop().getItems().size()>0)
-//			Debug.debug("iptc size", metadata.getPhotoshop().getItems().size());
+			// Debug.debug("iptc size",
+			// metadata.getPhotoshop().getItems().size());
+
+			JpegPhotoshopMetadata psMetadata = metadata.getPhotoshop();
+			List oldRecords = psMetadata.photoshopApp13Data.getRecords();
+
+			System.out.println();
+			for (int j = 0; j < oldRecords.size(); j++)
+			{
+				IPTCRecord record = (IPTCRecord) oldRecords.get(j);
+				if (record.iptcType.type != IPTCConstants.IPTC_TYPE_CITY.type)
+					System.out.println("Key: " + record.iptcType.name + " (0x"
+							+ Integer.toHexString(record.iptcType.type)
+							+ "), value: " + record.value);
+			}
+			System.out.println();
 		}
 	}
 

Modified: incubator/sanselan/trunk/src/test/java/org/apache/sanselan/formats/jpeg/iptc/IptcUpdateTest.java
URL: http://svn.apache.org/viewvc/incubator/sanselan/trunk/src/test/java/org/apache/sanselan/formats/jpeg/iptc/IptcUpdateTest.java?rev=703730&r1=703729&r2=703730&view=diff
==============================================================================
--- incubator/sanselan/trunk/src/test/java/org/apache/sanselan/formats/jpeg/iptc/IptcUpdateTest.java (original)
+++ incubator/sanselan/trunk/src/test/java/org/apache/sanselan/formats/jpeg/iptc/IptcUpdateTest.java Sat Oct 11 13:53:40 2008
@@ -47,65 +47,68 @@
 		imagesWithIptcData = getImagesWithIptcData();
 	}
 
-//	public void testRemove() throws IOException, ImageReadException,
-//			ImageWriteException
-//	{
-//		List images = imagesWithIptcData;
-//		for (int i = 0; i < images.size(); i++)
-//		{
-//			if (i % 10 == 0)
-//				Debug.purgeMemory();
-//
-//			File imageFile = (File) images.get(i);
-//			Debug.debug("imageFile", imageFile);
-//			Debug.debug();
-//
-//			ByteSource byteSource = new ByteSourceFile(imageFile);
-//			// Debug.debug("Segments:");
-//			// new JpegUtils().dumpJFIF(byteSource);
-//
-//			Map params = new HashMap();
-//			boolean ignoreImageData = isPhilHarveyTestImage(imageFile);
-//			params
-//					.put(PARAM_KEY_READ_THUMBNAILS, new Boolean(
-//							!ignoreImageData));
-//			// params.put(PARAM_KEY_VERBOSE, Boolean.TRUE);
-//			// params.put(PARAM_KEY_VERBOSE, Boolean.TRUE);
-//
-//			JpegPhotoshopMetadata metadata = new JpegImageParser()
-//					.getPhotoshopMetadata(byteSource, params);
-//			assertNotNull(metadata);
-//			metadata.dump();
-//
-//			File noIptcFile = createTempFile(imageFile.getName()
-//					+ ".iptc.remove.", ".jpg");
-//			{
-//				// test remove
-//
-//				OutputStream os = null;
-//				try
-//				{
-//					os = new FileOutputStream(noIptcFile);
-//					os = new BufferedOutputStream(os);
-//					new JpegIptcRewriter().removeIPTC(byteSource, os);
-//				} finally
-//				{
-//					os.close();
-//					os = null;
-//				}
-//
-//				// Debug.debug("Source Segments:");
-//				// new JpegUtils().dumpJFIF(new ByteSourceFile(noIptcFile));
-//
-//				JpegPhotoshopMetadata outMetadata = new JpegImageParser()
-//						.getPhotoshopMetadata(new ByteSourceFile(noIptcFile),
-//								params);
-//				assertTrue(outMetadata == null
-//						|| outMetadata.getItems().size() == 0);
-//			}
-//
-//		}
-//	}
+	public void tearDown() throws Exception
+	{
+		super.tearDown();
+
+		imagesWithIptcData = null;
+	}
+
+	/*
+	 * Remove all Photoshop IPTC data from a JPEG file.
+	 */
+	public void testRemove() throws IOException, ImageReadException,
+			ImageWriteException
+	{
+		List images = imagesWithIptcData;
+		for (int i = 0; i < images.size(); i++)
+		{
+			if (i % 10 == 0)
+				Debug.purgeMemory();
+
+			File imageFile = (File) images.get(i);
+			// Debug.debug("imageFile", imageFile);
+			// Debug.debug();
+
+			ByteSource byteSource = new ByteSourceFile(imageFile);
+
+			Map params = new HashMap();
+			boolean ignoreImageData = isPhilHarveyTestImage(imageFile);
+			params
+					.put(PARAM_KEY_READ_THUMBNAILS, new Boolean(
+							!ignoreImageData));
+
+			JpegPhotoshopMetadata metadata = new JpegImageParser()
+					.getPhotoshopMetadata(byteSource, params);
+			assertNotNull(metadata);
+			// metadata.dump();
+
+			File noIptcFile = createTempFile(imageFile.getName()
+					+ ".iptc.remove.", ".jpg");
+			{
+				// test remove
+
+				OutputStream os = null;
+				try
+				{
+					os = new FileOutputStream(noIptcFile);
+					os = new BufferedOutputStream(os);
+					new JpegIptcRewriter().removeIPTC(byteSource, os);
+				} finally
+				{
+					os.close();
+					os = null;
+				}
+
+				JpegPhotoshopMetadata outMetadata = new JpegImageParser()
+						.getPhotoshopMetadata(new ByteSourceFile(noIptcFile),
+								params);
+				assertTrue(outMetadata == null
+						|| outMetadata.getItems().size() == 0);
+			}
+
+		}
+	}
 
 	public void testRemoveInsertUpdate() throws IOException,
 			ImageReadException, ImageWriteException
@@ -280,7 +283,8 @@
 				{
 					os = new FileOutputStream(updated);
 					os = new BufferedOutputStream(os);
-					new JpegIptcRewriter().writeIPTC(new ByteSourceFile(noIptcFile), os, newData);
+					new JpegIptcRewriter().writeIPTC(new ByteSourceFile(
+							noIptcFile), os, newData);
 				} finally
 				{
 					os.close();
@@ -305,4 +309,104 @@
 
 		}
 	}
+
+	/*
+	 * Add a few IPTC values to JPEG images, whether or not they have existing
+	 * IPTC data.
+	 */
+	public void testAddIptcData() throws IOException, ImageReadException,
+			ImageWriteException
+	{
+		List images = getJpegImages();
+		for (int i = 0; i < images.size(); i++)
+		{
+			if (i % 10 == 0)
+				Debug.purgeMemory();
+
+			File imageFile = (File) images.get(i);
+//			 Debug.debug("imageFile", imageFile);
+//			 Debug.debug();
+
+			ByteSource byteSource = new ByteSourceFile(imageFile);
+//			 Debug.debug("Segments:");
+//			 new JpegUtils().dumpJFIF(byteSource);
+
+			Map params = new HashMap();
+			boolean ignoreImageData = isPhilHarveyTestImage(imageFile);
+			params
+					.put(PARAM_KEY_READ_THUMBNAILS, new Boolean(
+							!ignoreImageData));
+
+			JpegPhotoshopMetadata metadata = new JpegImageParser()
+					.getPhotoshopMetadata(byteSource, params);
+			// metadata.dump();
+
+			{
+				List newBlocks = new ArrayList();
+				List newRecords = new ArrayList();
+
+				if (null != metadata)
+				{
+					boolean keepOldIptcNonTextValues = true;
+					if (keepOldIptcNonTextValues)
+						newBlocks.addAll(metadata.photoshopApp13Data
+								.getNonIptcBlocks());
+					boolean keepOldIptcTextValues = true;
+					if (keepOldIptcTextValues)
+					{
+						List oldRecords = metadata.photoshopApp13Data
+								.getRecords();
+
+						newRecords = new ArrayList();
+						for (int j = 0; j < oldRecords.size(); j++)
+						{
+							IPTCRecord record = (IPTCRecord) oldRecords.get(j);
+							if (record.iptcType.type != IPTCConstants.IPTC_TYPE_CITY.type
+									&& record.iptcType.type != IPTCConstants.IPTC_TYPE_CREDIT.type)
+								newRecords.add(record);
+						}
+					}
+				}
+
+				newRecords.add(new IPTCRecord(IPTCConstants.IPTC_TYPE_CITY,
+						"Albany, NY"));
+				newRecords.add(new IPTCRecord(IPTCConstants.IPTC_TYPE_CREDIT,
+						"William Sorensen"));
+
+				PhotoshopApp13Data newData = new PhotoshopApp13Data(newRecords,
+						newBlocks);
+
+				File updated = createTempFile(imageFile.getName()
+						+ ".iptc.add.", ".jpg");
+				OutputStream os = null;
+				try
+				{
+					os = new FileOutputStream(updated);
+					os = new BufferedOutputStream(os);
+					new JpegIptcRewriter().writeIPTC(byteSource, os, newData);
+				} finally
+				{
+					os.close();
+					os = null;
+				}
+
+				// Debug.debug("Destination Segments:");
+				// new JpegUtils().dumpJFIF(new ByteSourceFile(updated));
+
+				ByteSource updateByteSource = new ByteSourceFile(updated);
+				JpegPhotoshopMetadata outMetadata = new JpegImageParser()
+						.getPhotoshopMetadata(updateByteSource, params);
+
+				// Debug.debug("outMetadata", outMetadata.toString());
+				// Debug.debug("hasIptcSegment", new JpegImageParser()
+				// .hasIptcSegment(updateByteSource));
+
+				assertNotNull(outMetadata);
+				assertTrue(outMetadata.getItems().size() == newRecords.size());
+				// assertEquals(metadata.toString(), outMetadata.toString());
+			}
+
+		}
+	}
+
 }



Mime
View raw message