Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle Exif profiles in JPEG files #253

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1161,9 +1161,17 @@ private DefaultMutableTreeNode nisoToNode (NisoImageMetadata niso)
val.add (new DefaultMutableTreeNode
("DigitalCameraManufacturer: " + s, false));
}
if ((s = niso.getDigitalCameraModel ()) != null) {
if ((s = niso.getDigitalCameraModelName ()) != null) {
val.add (new DefaultMutableTreeNode
("DigitalCameraModel: " + s, false));
("DigitalCameraModelName: " + s, false));
}
if ((s = niso.getDigitalCameraModelNumber ()) != null) {
val.add (new DefaultMutableTreeNode
("DigitalCameraModelNumber: " + s, false));
}
if ((s = niso.getDigitalCameraModelSerialNo ()) != null) {
val.add (new DefaultMutableTreeNode
("DigitalCameraModelSerialNo: " + s, false));
}
if ((d = niso.getFNumber ()) != NisoImageMetadata.NILL) {
val.add (new DefaultMutableTreeNode
Expand All @@ -1173,6 +1181,14 @@ private DefaultMutableTreeNode nisoToNode (NisoImageMetadata niso)
val.add (new DefaultMutableTreeNode
("ExposureTime: " + Double.toString (d), false));
}
if ((n = niso.getExposureProgram ()) != NisoImageMetadata.NULL) {
val.add (new DefaultMutableTreeNode
("ExposureProgram: " + Integer.toString (n), false));
}
if ((s = niso.getExifVersion ()) != null) {
val.add (new DefaultMutableTreeNode
("ExifVersion: " + s, false));
}
if ((d = niso.getBrightness ()) != NisoImageMetadata.NILL) {
val.add (new DefaultMutableTreeNode
("Brightness: " + Double.toString (d), false));
Expand Down
31 changes: 27 additions & 4 deletions jhove-bbt/scripts/create-1.17-target.sh
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,34 @@ fi
# Issue 62 add ICCProfileName
if [[ -f "${candidateRoot}/examples/modules/JPEG-hul/AA_Banner-progressive.jpg.jhove.xml" ]]; then
cp "${candidateRoot}/examples/modules/JPEG-hul/AA_Banner-progressive.jpg.jhove.xml" "${targetRoot}/examples/modules/JPEG-hul/"
fi;
fi
if [[ -f "${candidateRoot}/examples/modules/JPEG-hul/AA_Banner.jpg.jhove.xml" ]]; then
cp "${candidateRoot}/examples/modules/JPEG-hul/AA_Banner.jpg.jhove.xml" "${targetRoot}/examples/modules/JPEG-hul/"
fi;
fi
if [[ -f "${candidateRoot}/examples/modules/TIFF-hul/6mp_soft.tif.jhove.xml" ]]; then
cp "${candidateRoot}/examples/modules/TIFF-hul/6mp_soft.tif.jhove.xml" "${targetRoot}/examples/modules/TIFF-hul/"
fi
if [[ -f "${candidateRoot}/examples/modules/TIFF-hul/AA_Banner.tif.jhove.xml" ]]; then
cp "${candidateRoot}/examples/modules/TIFF-hul/AA_Banner.tif.jhove.xml" "${targetRoot}/examples/modules/TIFF-hul/"
fi;

fi
# Issue 60 add new file 20150213_140637.jpg with exif profile
if [[ -f "${candidateRoot}/examples/modules/JPEG-hul/20150213_140637.jpg.jhove.xml" ]]; then
cp "${candidateRoot}/examples/modules/JPEG-hul/20150213_140637.jpg.jhove.xml" "${targetRoot}/examples/modules/JPEG-hul/"
fi
# Issue 60 add new audit for JPEG and TIFF since new documentation added
if [[ -f "${candidateRoot}/examples/modules/audit-JPEG-hul.jhove.xml" ]]; then
cp "${candidateRoot}/examples/modules/audit-JPEG-hul.jhove.xml" "${targetRoot}/examples/modules/"
fi
if [[ -f "${candidateRoot}/examples/modules/audit-TIFF-hul.jhove.xml" ]]; then
cp "${candidateRoot}/examples/modules/audit-TIFF-hul.jhove.xml" "${targetRoot}/examples/modules/"
fi
find "${targetRoot}" -type f -name "audit.jhove.xml" -exec sed -i 's/^ <module release="1.2">JPEG-hul<\/module>$/ <module release="1.3">JPEG-hul<\/module>/' {} \;
find "${targetRoot}" -type f -name "audit.jhove.xml" -exec sed -i 's/^ <module release="1.7">TIFF-hul<\/module>$/ <module release="1.8">TIFF-hul<\/module>/' {} \;
find "${targetRoot}" -type f -name "*.tif.jhove.xml" -exec sed -i 's%<reportingModule release="1.7" date="2012-08-12">TIFF%<reportingModule release="1.8" date="2017-05-11">TIFF%' {} \;
find "${targetRoot}" -type f -name "*.g3.jhove.xml" -exec sed -i 's%<reportingModule release="1.7" date="2012-08-12">TIFF%<reportingModule release="1.8" date="2017-05-11">TIFF%' {} \;
find "${targetRoot}" -type f -name "bathy1.*.jhove.xml" -exec sed -i 's%<reportingModule release="1.7" date="2012-08-12">TIFF%<reportingModule release="1.8" date="2017-05-11">TIFF%' {} \;
find "${targetRoot}" -type f -name "compos.*.jhove.xml" -exec sed -i 's%<reportingModule release="1.7" date="2012-08-12">TIFF%<reportingModule release="1.8" date="2017-05-11">TIFF%' {} \;
find "${targetRoot}" -type f -name "*.jpg.jhove.xml" -exec sed -i 's%<reportingModule release="1.2" date="2007-02-13">JPEG%<reportingModule release="1.3" date="2017-05-11">JPEG%' {} \;
find "${targetRoot}" -type f -name "README.jhove.xml" -exec sed -i 's%<reportingModule release="1.7" date="2012-08-12">TIFF%<reportingModule release="1.8" date="2017-05-11">TIFF%' {} \;
find "${targetRoot}" -type f -name "README.jhove.xml" -exec sed -i 's%<reportingModule release="1.2" date="2007-02-13">JPEG%<reportingModule release="1.3" date="2017-05-11">JPEG%' {} \;
find "${targetRoot}" -type f -name "*.wav.jhove.xml" -exec sed -i 's%44100.0</aes:sampleRate>%44100</aes:sampleRate>%' {} \;
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public class NisoImageMetadata

/** 7.7.3.13 back light value labels. */
public static final String [] BACKLIGHT = {
"front leight", "backlight 1", "backlight 2"
"front light", "backlight 1", "backlight 2"
};

/** 6.1.2 byte order value labels. */
Expand Down Expand Up @@ -111,6 +111,14 @@ public class NisoImageMetadata
"range or depth"
};

public static final String [] EXPOSURE_PROGRAM = {
"Not defined", " Manual", "Normal program", "Aperture priority",
"Shutter priority", "Creative program (biased toward depth of field)",
"Action program (biased toward fast shutter speed)",
"Portrait mode (for closeup photos with the background out of focus)",
"Landscape mode (for landscape photos with the background in focus)"
};

/** 7.7.3.10 flash value labels. */
public static final String [] FLASH = {
"yes", "no"
Expand Down Expand Up @@ -149,7 +157,7 @@ public class NisoImageMetadata

/** 7.7.3.6 metering mode value labels. */
public static final String [] METERING_MODE = {
"unidentified", "average", "center-weighted average", "spot",
"unidentified", "average", "center weighted average", "spot",
"multispot", "pattern", "partial"
};

Expand Down Expand Up @@ -344,13 +352,22 @@ public class NisoImageMetadata

/** 7.7.1 Digital camera manufacturer */
private String _digitalCameraManufacturer;
/** 7.7.2 Digital camera model */
private String _digitalCameraModel;
/** 7.7.2 Digital camera model name */
private String _digitalCameraModelName;
/** 7.7.2 Digital camera model number */
private String _digitalCameraModelNumber;
/** 7.7.2 Digital camera model serial number*/
private String _digitalCameraModelSerialNo;

/** 7.7.3.1 F number */
private double _fNumber;
/** 7.7.3.2 Exposure time */
private double _exposureTime;

private int _exposureProgram;
private String _exifVersion;
private Rational _maxApertureValue;

/** 7.7.3.3 Brightness */
private double _brightness;
/** 7.7.3.4 Exposure bias */
Expand Down Expand Up @@ -511,9 +528,15 @@ public NisoImageMetadata ()
_compressionLevel = NULL;
_compressionScheme = NULL;
_dateTimeProcessed = null;
_digitalCameraManufacturer = null;
_digitalCameraModelName = null;
_digitalCameraModelNumber = null;
_digitalCameraModelSerialNo = null;
_displayOrientation = NULL;
_exifVersion = null;
_exposureBias = NILL;
_exposureIndex = NILL;
_exposureProgram = NULL;
_exposureTime = NILL;
_fileSize = NULL;
_flash = NULL;
Expand All @@ -525,6 +548,7 @@ public NisoImageMetadata ()
_imageData = null;
_imageLength = NULL;
_imageWidth = NULL;
_maxApertureValue = null;
_meteringMode = NULL;
_orientation = NULL;
_performanceData = null;
Expand All @@ -536,6 +560,10 @@ public NisoImageMetadata ()
_processingSoftwareVersion = null;
_profiles = null;
_rowsPerStrip = NULL;
_scannerManufacturer = null;
_scannerModelName = null;
_scannerModelNumber = null;
_scannerModelSerialNo = null;
_samplesPerPixel = NULL;
_samplingFrequencyPlane = NULL;
_samplingFrequencyUnit = NULL;
Expand Down Expand Up @@ -693,9 +721,17 @@ public String getDigitalCameraManufacturer ()
}

/** Get 7.7.2 digital camera model. */
public String getDigitalCameraModel ()
public String getDigitalCameraModelName ()
{
return _digitalCameraModelName;
}
public String getDigitalCameraModelNumber ()
{
return _digitalCameraModelNumber;
}
public String getDigitalCameraModelSerialNo()
{
return _digitalCameraModel;
return _digitalCameraModelSerialNo;
}

/** Get 6.2.5 Display orientation. */
Expand All @@ -704,6 +740,11 @@ public int getDisplayOrientation ()
return _displayOrientation;
}

public String getExifVersion ()
{
return _exifVersion;
}

/** Get 7.7.3.4 exposure bias. */
public double getExposureBias ()
{
Expand All @@ -716,6 +757,11 @@ public double getExposureIndex ()
return _exposureIndex;
}

public int getExposureProgram ()
{
return _exposureProgram;
}

/** Get 7.7.3.2 exposure time. */
public double getExposureTime ()
{
Expand Down Expand Up @@ -818,6 +864,11 @@ public long getImageWidth ()
return _imageWidth;
}

public Rational getMaxApertureValue ()
{
return _maxApertureValue;
}

/** Get 7.7.3.6 metering mode. */
public int getMeteringMode ()
{
Expand Down Expand Up @@ -1388,9 +1439,17 @@ public void setDigitalCameraManufacturer (String manufacturer)
/** Set 7.7.2 digital camera model.
* @param model Camera model
*/
public void setDigitalCameraModel (String model)
public void setDigitalCameraModelName (String modelName)
{
_digitalCameraModelName = modelName;
}
public void setDigitalCameraModelNumber (String modelNumber)
{
_digitalCameraModel = model;
_digitalCameraModelNumber = modelNumber;
}
public void setDigitalCameraModelSerialNo (String modelSerialNo)
{
_digitalCameraModelSerialNo = modelSerialNo;
}

/** Set 6.2.5 display orientation.
Expand All @@ -1401,6 +1460,11 @@ public void setDisplayOrientation (int orientation)
_displayOrientation = orientation;
}

public void setExifVersion (String version)
{
_exifVersion = version;
}

/** Set 7.2.3.4 exposure bias.
* @param bias Exposure bias
*/
Expand All @@ -1417,6 +1481,11 @@ public void setExposureIndex (double index)
_exposureIndex = index;
}

public void setExposureProgram (int program)
{
_exposureProgram = program;
}

/** Set 7.7.3.2 exposure time.
* @param time Exposure time
*/
Expand Down Expand Up @@ -1553,6 +1622,11 @@ public void setImageWidth (long width)
_imageWidth = width;
}

public void setMaxApertureValue (Rational value)
{
_maxApertureValue = value;
}

/** Set 7.7.3.6 metering mode.
* @param mode Metering mode
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public TextHandler ()
super (NAME, RELEASE, DATE, NOTE, RIGHTS);
_vendor = Agent.harvardInstance();

_format = NumberFormat.getInstance ();
_format = NumberFormat.getInstance (Locale.ROOT);
_format.setGroupingUsed (false);
_format.setMinimumFractionDigits (0);
}
Expand Down Expand Up @@ -1338,8 +1338,14 @@ private void showNisoImageMetadata02 (NisoImageMetadata niso, String margin,
if ((s = niso.getDigitalCameraManufacturer ()) != null) {
_writer.println (margn2 + "DigitalCameraManufacturer: " + s);
}
if ((s = niso.getDigitalCameraModel ()) != null) {
_writer.println (margn2 + "DigitalCameraModel: " + s);
if ((s = niso.getDigitalCameraModelName ()) != null) {
_writer.println (margn2 + "DigitalCameraModelName: " + s);
}
if ((s = niso.getDigitalCameraModelNumber ()) != null) {
_writer.println (margn2 + "DigitalCameraModelNumber: " + s);
}
if ((s = niso.getDigitalCameraModelSerialNo ()) != null) {
_writer.println (margn2 + "DigitalCameraModelSerialNo: " + s);
}
if ((d = niso.getFNumber ()) != NisoImageMetadata.NILL) {
_writer.println (margn2 + "FNumber: " + d);
Expand Down Expand Up @@ -1759,14 +1765,33 @@ else if (s.startsWith ("little")) {
if ((s = niso.getDigitalCameraManufacturer ()) != null) {
_writer.println (margn2 + "DigitalCameraManufacturer: " + s);
}
if ((s = niso.getDigitalCameraModel ()) != null) {
_writer.println (margn2 + "DigitalCameraModel: " + s);
if ((s = niso.getDigitalCameraModelName ()) != null) {
_writer.println (margn2 + "DigitalCameraModelName: " + s);
}
if ((s = niso.getDigitalCameraModelNumber ()) != null) {
_writer.println (margn2 + "DigitalCameraModelNumber: " + s);
}
if ((s = niso.getDigitalCameraModelSerialNo ()) != null) {
_writer.println (margn2 + "DigitalCameraModelSerialNo: " + s);
}
if ((d = niso.getFNumber ()) != NisoImageMetadata.NILL) {
_writer.println (margn2 + "FNumber: " + d);
_writer.println (margn2 + "FNumber: " + _format.format(d));
}
if ((s = niso.getExifVersion ()) != null) {
_writer.println (margn2 + "ExifVersion: " + s);
}
Rational r;
if ((r = niso.getMaxApertureValue ()) != null) {
_writer.println (margn2 + "MaxApertureValue: " +
addRationalValue (r, rawOutput));
}
if ((d = niso.getExposureTime ()) != NisoImageMetadata.NILL) {
_writer.println (margn2 + "ExposureTime: " + d);
_writer.println (margn2 + "ExposureTime: " + _format.format(d));
}
if ((n = niso.getExposureProgram ()) != NisoImageMetadata.NULL) {
_writer.println (margn2 + "ExposureProgram: " +
addIntegerValue (n, NisoImageMetadata.EXPOSURE_PROGRAM,
rawOutput));
}
if ((d = niso.getBrightness ()) != NisoImageMetadata.NILL) {
_writer.println (margn2 + "BrightnessValue: " + d);
Expand Down Expand Up @@ -1835,7 +1860,7 @@ else if (s.startsWith ("little")) {
addIntegerValue (n, NisoImageMetadata.SAMPLING_FREQUENCY_UNIT,
rawOutput));
}
Rational r = niso.getXSamplingFrequency ();
r = niso.getXSamplingFrequency ();
if (r != null) {
_writer.println (margn2 + "XSamplingFrequency: " +
addRationalValue (r, rawOutput));
Expand Down
Loading