width=MagickMin(source_image->columns,destination_image->columns);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
#pragma omp parallel for schedule(static) shared(status) \
- dynamic_number_threads(width,height,1)
+ dynamic_number_threads(source_image,width,height,1)
#endif
for (y=0; y < (ssize_t) height; y++)
{
if (destination_image == (Image *) NULL)
return((Image *) NULL);
if (IsGrayColorspace(image->colorspace) != MagickFalse)
- (void) TransformImageColorspace((Image *) image,sRGBColorspace,exception);
+ (void) TransformImageColorspace((Image *) image,RGBColorspace,exception);
if (expression == (const char *) NULL)
return(destination_image);
destination_channel=RedPixelChannel;
return(destination_image);
}
if (IsGrayColorspace(canvas->colorspace) != MagickFalse)
- (void) TransformImageColorspace(canvas,sRGBColorspace,exception);
+ (void) TransformImageColorspace(canvas,RGBColorspace,exception);
AppendImageToList(&destination_image,canvas);
destination_image=GetLastImageInList(destination_image);
GetMagickToken(p,&p,token);
%
% The format of the CombineImages method is:
%
-% Image *CombineImages(const Image *image,ExceptionInfo *exception)
+% Image *CombineImages(const Image *images,const ColorspaceType colorspace,
+% ExceptionInfo *exception)
%
% A description of each parameter follows:
%
-% o image: the image.
+% o images: the image sequence.
+%
+% o colorspace: the image colorspace.
%
% o exception: return any errors or warnings in this structure.
%
*/
-MagickExport Image *CombineImages(const Image *image,ExceptionInfo *exception)
+MagickExport Image *CombineImages(const Image *image,
+ const ColorspaceType colorspace,ExceptionInfo *exception)
{
#define CombineImageTag "Combine/Image"
return((Image *) NULL);
}
if (IsGrayColorspace(image->colorspace) != MagickFalse)
- (void) SetImageColorspace(combine_image,sRGBColorspace,exception);
+ (void) SetImageColorspace(combine_image,RGBColorspace,exception);
if ((GetPixelAlphaTraits(image) & UpdatePixelTrait) != 0)
combine_image->matte=MagickTrue;
/*
q=pixels;
for (x=0; x < (ssize_t) combine_image->columns; x++)
{
- if (x < (ssize_t) image->columns)
+ if (x < (ssize_t) next->columns)
{
- q[i]=GetPixelGray(image,p);
- p+=GetPixelChannels(image);
+ q[i]=GetPixelGray(next,p);
+ p+=GetPixelChannels(next);
}
q+=GetPixelChannels(combine_image);
}
image_view=DestroyCacheView(image_view);
next=GetNextImageInList(next);
- if (SyncCacheViewAuthenticPixels(combine_view,exception) == MagickFalse)
- status=MagickFalse;
- if (image->progress_monitor != (MagickProgressMonitor) NULL)
- {
- MagickBooleanType
- proceed;
-
- proceed=SetImageProgress(image,CombineImageTag,progress++,
- combine_image->rows);
- if (proceed == MagickFalse)
- status=MagickFalse;
- }
}
+ if (SyncCacheViewAuthenticPixels(combine_view,exception) == MagickFalse)
+ status=MagickFalse;
+ if (image->progress_monitor != (MagickProgressMonitor) NULL)
+ {
+ MagickBooleanType
+ proceed;
+
+ proceed=SetImageProgress(image,CombineImageTag,progress++,
+ combine_image->rows);
+ if (proceed == MagickFalse)
+ status=MagickFalse;
+ }
}
combine_view=DestroyCacheView(combine_view);
if (status == MagickFalse)
combine_image=DestroyImage(combine_image);
+ (void) TransformImageColorspace(combine_image,colorspace,exception);
return(combine_image);
}
\f
separate_image=DestroyImage(separate_image);
return((Image *) NULL);
}
- separate_image->colorspace=GRAYColorspace;
separate_image->matte=MagickFalse;
+ (void) SetImageColorspace(separate_image,GRAYColorspace,exception);
/*
Separate image.
*/
separate_view=AcquireAuthenticCacheView(separate_image,exception);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
#pragma omp parallel for schedule(static) shared(progress,status) \
- dynamic_number_threads(image->columns,image->rows,1)
+ dynamic_number_threads(image,image->columns,image->rows,1)
#endif
for (y=0; y < (ssize_t) image->rows; y++)
{
SetPixelChannel(separate_image,GrayPixelChannel,0,q);
for (i=0; i < (ssize_t) GetPixelChannels(image); i++)
{
+ double
+ pixel;
+
PixelChannel
channel;
if ((traits == UndefinedPixelTrait) ||
(GetChannelBit(channel_type,channel) == 0))
continue;
- SetPixelChannel(separate_image,GrayPixelChannel,p[i],q);
+ pixel=p[i];
+ if (IssRGBColorspace(image->colorspace) != MagickFalse)
+ pixel=InversesRGBCompandor(pixel);
+ SetPixelChannel(separate_image,GrayPixelChannel,ClampToQuantum(pixel),
+ q);
}
p+=GetPixelChannels(image);
q+=GetPixelChannels(separate_image);