Franchi_S5#32632
Hi friends,
I continue with my project editing TIFF and JPEG images. I found what I think is a new bug.
As I told in another post, I use Jhove for digital objects validation. The problem now is with JPEG files.
If I validate the original JPEG, the result is OK. But when I edit the image with GM and then validate the output JPEG I have several error messages:
(Value offset not word-aligned: 133) and next.
I use the next code for JPEG edition:
then I crop and add a border to the input image as shown:
After this edition, the validation error is present. Even If I don´t change the EXIF or IPTC.
When I apply the same code adapted to TIFF images I have no validation errors, it only happens with JPEG files.
Attached input JPEG images: attach #1382
Attached output JPEG image: attach #1383
I need your help. 🤦 Thanks in advance. o:)
I continue with my project editing TIFF and JPEG images. I found what I think is a new bug.
As I told in another post, I use Jhove for digital objects validation. The problem now is with JPEG files.
If I validate the original JPEG, the result is OK. But when I edit the image with GM and then validate the output JPEG I have several error messages:
(Value offset not word-aligned: 133) and next.
<?xml version="1.0" encoding="utf-8"?>
<jhove xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://hul.harvard.edu/ois/xml/ns/jhove" xsi:schemaLocation="http://hul.harvard.edu/ois/xml/ns/jhove http://hul.harvard.edu/ois/xml/xsd/jhove/1.6/jhove.xsd" name="JhoveView" release="1.20.1" date="2018-03-29">
<date>2018-05-14T11:00:36+02:00</date>
<repInfo uri="E:%5CTEST%5CSALIDA%5C0005_cortada_con_error.jpg">
<reportingModule release="1.4" date="2018-03-29">JPEG-hul</reportingModule>
<lastModified>2018-05-11T09:57:29+02:00</lastModified>
<size>438221</size>
<format>JPEG</format>
<version>1.01</version>
<status>Well-Formed and valid</status>
<sigMatch>
<module>JPEG-hul</module>
</sigMatch>
<messages>
<message offset="30" severity="info">Value offset not word-aligned: 133</message>
<message offset="42" severity="info">Value offset not word-aligned: 189</message>
<message offset="54" severity="info">Value offset not word-aligned: 197</message>
<message offset="78" severity="info">Value offset not word-aligned: 205</message>
</messages>
<mimeType>image/jpeg</mimeType>
<profiles>
<profile>JFIF</profile>
</profiles>I use the next code for JPEG edition:
var exif = new Aurigma.GraphicsMill.Codecs.ExifDictionary();
var iptc = new Aurigma.GraphicsMill.Codecs.IptcDictionary();
if (procesar_exif == false)
{
exif = reader.Exif;
exif.Remove(ExifDictionary.Thumbnail);
writer.Exif = exif;
}
else
{
exif = reader.Exif;
exif.Remove(ExifDictionary.Thumbnail);
if (reader.Iptc != null) iptc = reader.Iptc;
if (checkBoxEXIF.Enabled) writer.Exif = InsertarEXIF(exif);
if (checkBoxIPTC.Checked) writer.Iptc = InsertarIPTC(iptc);
if (reader.Xmp != null) writer.Xmp = reader.Xmp;
}then I crop and add a border to the input image as shown:
using (var borderColor = RgbColor.Black)
using (var generator = new ImageGenerator(crop.Rectangle.Width + (int)border_size * 2, crop.Rectangle.Height + (int)border_size * 2, reader.PixelFormat, borderColor))
using (var blender = new Blender())
{
if (resolution == 0) // DON´T CHANGE INPUT RESOLUTION
{
blender.TopImage = reader.Frames[0] + crop;
blender.X = (int)border_size;
blender.Y = (int)border_size;
generator.DpiX = reader.DpiX;
generator.DpiY = reader.DpiY;
try
{
Pipeline.Run(generator + blender + writer);
crop.Dispose();
exif.Dispose();
iptc.Dispose();
errorRectangulo = false;
}
catch (Aurigma.GraphicsMill.PipelineException e)
{
ShowErrorGM(e);
}
}
else // CHANGE INPUT RESOLUTION
{
float ratio = resolution / reader.DpiX; // RATIO CALC
float border_size_tmp = border_size * ratio; // APPLY RATIO TO BORDER
border_size = (int)border_size_tmp;
float Pixels_X = ((rectangulo.Width / reader.DpiX) * resolution); //CALC SIZE FOR SCALE
float Pixels_Y = ((rectangulo.Height / reader.DpiY) * resolution);
generator.DpiX = resolution;
generator.DpiY = resolution;
generator.Width = (int)Pixels_X + (int)border_size * 2;
generator.Height = (int)Pixels_Y + (int)border_size * 2;
resize.Width = (int)Pixels_X;
resize.Height = (int)Pixels_Y;
resize.InterpolationMode = ResizeInterpolationMode.Medium;
blender.TopImage = reader.Frames[0] + crop + resize;
blender.X = (generator.Width - resize.Width) / 2;
blender.Y = (generator.Height - resize.Height) / 2;
try
{
Pipeline.Run(generator + blender + writer);
crop.Dispose();
exif.Dispose();
iptc.Dispose();
errorRectangulo = false;
}
catch (Aurigma.GraphicsMill.PipelineException e)
{
ShowErrorGM(e);
}
}
}After this edition, the validation error is present. Even If I don´t change the EXIF or IPTC.
When I apply the same code adapted to TIFF images I have no validation errors, it only happens with JPEG files.
Attached input JPEG images: attach #1382
Attached output JPEG image: attach #1383
I need your help. 🤦 Thanks in advance. o:)