% July 1992 %
% %
% %
-% Copyright 1999-2012 ImageMagick Studio LLC, a non-profit organization %
+% Copyright 1999-2013 ImageMagick Studio LLC, a non-profit organization %
% dedicated to making software imaging solutions freely available. %
% %
% You may not use this file except in compliance with the License. You may %
#include "MagickCore/monitor-private.h"
#include "MagickCore/option.h"
#include "MagickCore/pixel-accessor.h"
+#include "MagickCore/pixel-private.h"
#include "MagickCore/property.h"
#include "MagickCore/quantum.h"
#include "MagickCore/quantum-private.h"
length=0;
if (TIFFGetField(tiff,37724,&length,&profile) == 1)
(void) ReadProfile(image,"tiff:37724",profile,(ssize_t) length,exception);
+ if (TIFFGetField(tiff,34118,&length,&profile) == 1)
+ (void) ReadProfile(image,"tiff:34118",profile,(ssize_t) length,exception);
}
static void TIFFGetProperties(TIFF *tiff,Image *image,ExceptionInfo *exception)
SetImageColorspace(image,CMYKColorspace,exception);
if (photometric == PHOTOMETRIC_CIELAB)
SetImageColorspace(image,LabColorspace,exception);
+ TIFFGetProfiles(tiff,image,exception);
+ TIFFGetProperties(tiff,image,exception);
+ option=GetImageOption(image_info,"tiff:exif-properties");
+ if (IfMagickTrue(IsStringNotFalse(option))) /* enabled by default */
+ TIFFGetEXIFProperties(tiff,image,exception);
(void) TIFFGetFieldDefaulted(tiff,TIFFTAG_SAMPLESPERPIXEL,
&samples_per_pixel);
(void) TIFFGetFieldDefaulted(tiff,TIFFTAG_RESOLUTIONUNIT,&units);
(void) TIFFGetFieldDefaulted(tiff,TIFFTAG_YRESOLUTION,&y_resolution);
image->resolution.x=x_resolution;
image->resolution.y=y_resolution;
- x_position=(float) image->page.x/x_resolution;
- y_position=(float) image->page.y/y_resolution;
+ x_position=(float) PerceptibleReciprocal(x_resolution)*image->page.x;
+ y_position=(float) PerceptibleReciprocal(y_resolution)*image->page.y;
(void) TIFFGetFieldDefaulted(tiff,TIFFTAG_XPOSITION,&x_position);
(void) TIFFGetFieldDefaulted(tiff,TIFFTAG_YPOSITION,&y_position);
image->page.x=(ssize_t) ceil(x_position*x_resolution-0.5);
sampling_factor,exception);
(void) LogMagickEvent(CoderEvent,GetMagickModule(),
"Sampling Factors: %s",sampling_factor);
- if ((samples_per_pixel > 1) && (photometric == PHOTOMETRIC_YCBCR))
- {
- (void) TIFFSetField(tiff,TIFFTAG_JPEGCOLORMODE,
- JPEGCOLORMODE_RGB);
- photometric=PHOTOMETRIC_RGB;
- }
}
#endif
break;
case COMPRESSION_ADOBE_DEFLATE: image->compression=ZipCompression; break;
default: image->compression=RLECompression; break;
}
- TIFFGetProfiles(tiff,image,exception);
- TIFFGetProperties(tiff,image,exception);
- option=GetImageOption(image_info,"tiff:exif-properties");
- if (IfMagickTrue(IsStringNotFalse(option))) /* enabled by default */
- TIFFGetEXIFProperties(tiff,image,exception);
/*
Allocate memory for the image and pixel buffer.
*/
}
if (image->storage_class == PseudoClass)
image->depth=GetImageDepth(image,exception);
- if ((photometric == PHOTOMETRIC_LOGL) ||
- (photometric == PHOTOMETRIC_MINISBLACK) ||
- (photometric == PHOTOMETRIC_MINISWHITE))
- {
- image->type=GrayscaleType;
- if (bits_per_sample == 1)
- image->type=BilevelType;
- }
/*
Proceed to next image.
*/
static const TIFFFieldInfo
TIFFExtensions[] =
{
- {
- 37724, -3, -3, TIFF_UNDEFINED, FIELD_CUSTOM, 1, 1,
- (char *) "PhotoshopLayerData"
- }
+ { 37724, -3, -3, TIFF_UNDEFINED, FIELD_CUSTOM, 1, 1,
+ (char *) "PhotoshopLayerData" },
+ { 34118, -3, -3, TIFF_UNDEFINED, FIELD_CUSTOM, 1, 1,
+ (char *) "Microscope" }
};
TIFFMergeFieldInfo(tiff,TIFFExtensions,sizeof(TIFFExtensions)/
if (LocaleCompare(name,"tiff:37724") == 0)
(void) TIFFSetField(tiff,37724,(uint32) GetStringInfoLength(profile),
GetStringInfoDatum(profile));
+ if (LocaleCompare(name,"tiff:34118") == 0)
+ (void) TIFFSetField(tiff,34118,(uint32) GetStringInfoLength(profile),
+ GetStringInfoDatum(profile));
name=GetNextImageProfile(image);
}
}
MagickFalse ? PHOTOMETRIC_MINISWHITE :
PHOTOMETRIC_MINISBLACK);
(void) TIFFSetField(tiff,TIFFTAG_SAMPLESPERPIXEL,1);
- if ((image_info->depth == 0) && (image->alpha_trait != BlendPixelTrait) &&
+ if ((image_info->depth == 0) &&
+ (image->alpha_trait != BlendPixelTrait) &&
(IsImageMonochrome(image,exception) != MagickFalse))
{
status=SetQuantumDepth(image,quantum_info,1);
(void) TIFFSetField(tiff,TIFFTAG_RESOLUTIONUNIT,(uint16) units);
(void) TIFFSetField(tiff,TIFFTAG_XRESOLUTION,image->resolution.x);
(void) TIFFSetField(tiff,TIFFTAG_YRESOLUTION,image->resolution.y);
- if ((image->page.x != 0) || (image->page.y != 0))
+ if ((image->page.x > 0) && (image->page.y > 0))
{
/*
Set image position.