% Write A Steganographic Image. %
% %
% Software Design %
-% John Cristy %
+% Cristy %
% July 1992 %
% %
% %
-% Copyright 1999-2011 ImageMagick Studio LLC, a non-profit organization %
+% Copyright 1999-2017 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 %
% obtain a copy of the License at %
% %
-% http://www.imagemagick.org/script/license.php %
+% https://www.imagemagick.org/script/license.php %
% %
% Unless required by applicable law or agreed to in writing, software %
% distributed under the License is distributed on an "AS IS" BASIS, %
% o exception: return any errors or warnings in this structure.
%
*/
-
-static inline size_t MagickMin(const size_t x,
- const size_t y)
-{
- if (x < y)
- return(x);
- return(y);
-}
-
static Image *ReadSTEGANOImage(const ImageInfo *image_info,
ExceptionInfo *exception)
{
-#define GetBit(alpha,i) MagickMin((((size_t) (alpha) >> (size_t) \
- (i)) & 0x01),16)
-#define SetBit(i,set) SetPixelIndex(image,((set) != 0 ? \
+#define GetBit(alpha,i) (((size_t) (alpha) >> (size_t) (i)) & 0x01)
+#define SetBit(i,set) SetPixelIndex(image,(Quantum) ((set) != 0 ? \
(size_t) GetPixelIndex(image,q) | (one << (size_t) (i)) : \
(size_t) GetPixelIndex(image,q) & ~(one << (size_t) (i))),q)
MagickBooleanType
status;
- PixelPacket
+ PixelInfo
pixel;
register Quantum
Initialize Image structure.
*/
assert(image_info != (const ImageInfo *) NULL);
- assert(image_info->signature == MagickSignature);
+ assert(image_info->signature == MagickCoreSignature);
if (image_info->debug != MagickFalse)
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",
image_info->filename);
assert(exception != (ExceptionInfo *) NULL);
- assert(exception->signature == MagickSignature);
+ assert(exception->signature == MagickCoreSignature);
one=1;
image=AcquireImage(image_info,exception);
if ((image->columns == 0) || (image->rows == 0))
(void) CloseBlob(image);
return(GetFirstImageInList(image));
}
+ status=SetImageExtent(image,image->columns,image->rows,exception);
+ if (status == MagickFalse)
+ return(DestroyImageList(image));
+ for (y=0; y < (ssize_t) image->rows; y++)
+ {
+ q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);
+ if (q == (Quantum *) NULL)
+ break;
+ for (x=0; x < (ssize_t) image->columns; x++)
+ {
+ SetPixelIndex(image,0,q);
+ q+=GetPixelChannels(image);
+ }
+ if (SyncAuthenticPixels(image,exception) == MagickFalse)
+ break;
+ }
/*
Get hidden watermark from low-order bits of image.
*/
x=0;
for ( ; (x < (ssize_t) image->columns) && (j < (ssize_t) depth); x++)
{
- Quantum
- virtual_pixel[MaxPixelChannels];
-
if ((k/(ssize_t) watermark->columns) >= (ssize_t) watermark->rows)
break;
- (void) GetOneVirtualPixel(watermark,k % (ssize_t) watermark->columns,
- k/(ssize_t) watermark->columns,virtual_pixel,exception);
- pixel.red=virtual_pixel[RedPixelChannel];
- pixel.green=virtual_pixel[GreenPixelChannel];
- pixel.blue=virtual_pixel[BluePixelChannel];
- pixel.alpha=virtual_pixel[AlphaPixelChannel];
+ (void) GetOneVirtualPixelInfo(watermark,UndefinedVirtualPixelMethod,
+ k % (ssize_t) watermark->columns,k/(ssize_t) watermark->columns,
+ &pixel,exception);
q=GetAuthenticPixels(image,x,y,1,1,exception);
if (q == (Quantum *) NULL)
break;
break;
}
watermark=DestroyImage(watermark);
- (void) SyncImage(image);
+ (void) SyncImage(image,exception);
return(GetFirstImageInList(image));
}
\f
MagickInfo
*entry;
- entry=SetMagickInfo("STEGANO");
+ entry=AcquireMagickInfo("STEGANO","STEGANO","Steganographic image");
entry->decoder=(DecodeImageHandler *) ReadSTEGANOImage;
entry->format_type=ImplicitFormatType;
- entry->description=ConstantString("Steganographic image");
- entry->module=ConstantString("STEGANO");
(void) RegisterMagickInfo(entry);
return(MagickImageCoderSignature);
}