static void DecodePage(ImGearRasterPage inPage, ImGearRasterPage outPage) { // Along the line y = m*x + b, where m = BarcodeSlope and b = BarcodeYIntercept, // Read pixels along the line from the inPage image. Transform the RGB values to CMYK. // Values less than 128 should be set to 0, and greater than or equal to 128 should be 255. // Finally, call the WriteColumn(...) function with one of the channel values. }
static void Main(string[] args) { ImGearLicense.SetSolutionName("Accusoft"); ImGearLicense.SetSolutionKey(0x00000000, 0x00000000, 0x00000000, 0x00000000); ImGearLicense.SetOEMLicenseKey("2.0.E6dKRyMXM7REMwJuP0JK2YUXG7RCFaiSiQUY4EiukyGEkQ2aJuFwsCRjGCU9RacudaMaMCGjHYFEMCducEFQP0GScSUjkYFuPKiuG7sw57iQc0i9k72aPjcjHXJKR7UQPCsQ20iSiEPQUYdjJKRCH9FKMyJSPYdSF9kyUKdQdKJQHYP7dYJY5udy26MwWY5CdQGQFSPY4QsuUyiS50ij2a2aGCGj5KPuHE4QUuM7GwcQJXMwJ7FukX2QMaRXdyMYP9HykKJusCkwUQc9MKME46c9HCd9GaJQPK5XRaP9M0MKPa2aJudKk9Fjd9U94EGuPEsyP9GjsXFQJXHC5QRQUSdSiy26s6cX4yijRCFEJ7JwF0suk75aRCRYGUY"); new BarcodeXpress().Licensing.SetOEMLicenseKey("2.0.ENhwvGbL56y2F6F6l3n7F7hNlNsBv7l7FLy2e2d4FpD8fByBbkFGFZeSW6yw53b3W7WLeZn3xjF8ywxjFSsGvGfZxGv4dG56f3W4s4nkfSF4fSF4lZD2FSD4hUf3bBWBdNn853bSf8nwW6DGW7dLeZn3xje3fwlZb45jvwU3xGv4DjFwd8bSs7lBUkbBb7y7y3s2D4d4yNxLbNdBeNd8dLf2f3xLv8U3f2W8FLvLF6UjeZWjeWdB7"); ImGearCommonFormats.Initialize(); // Load the image ImGearRasterPage inPage; using (var stream = new FileStream("trees.jpg", FileMode.Open)) inPage = ImGearFileFormats.LoadPage(stream, 0) as ImGearRasterPage; // Create a result page for the barcode ImGearRasterPage outPage = new ImGearRasterPage(inPage.DIB.Width, inPage.DIB.Height, new ImGearColorSpace(ImGearColorSpaceIDs.RGB), new int[] { 8, 8, 8 }, true); // Transform the input image into the output barcode DecodePage(inPage, outPage); // Read the encoded barcode! ReadBarcodes(outPage); }
static void WriteColumn(ImGearRasterPage outPage, int xCoordinate, int value) { var pixel = new ImGearPixel(3, 8); pixel[0] = pixel[1] = pixel[2] = value; // Write a pixel value to each y-coordinate, given an x-coordinate (ie. write a full column of the same pixel) // <code here> }
static void ReadBarcodes(ImGearRasterPage page) { Result[] barcodeResults = new Result[] { }; // Given a raster page, attempt to read any barcodes from this image. // <code here> // For each barcode found, print the interpreted value to the screen and pause foreach (var result in barcodeResults) { Console.WriteLine($"The password is: {result.BarcodeValue}"); Console.ReadLine(); } }
//This function should return an ImGearPage that contains the extracted hidden image public static ImGearPage ExtractHiddenImage(ImGearPage mergedImage) { int bitNum = 1; int bitShift = mergedImage.DIB.BitsPerChannel - bitNum; int bitMask = 0xFF >> bitShift; int imageWidth = mergedImage.DIB.Width; int imageHeight = mergedImage.DIB.Height; // initialize blank ImGearRasterPage ImGearPage hidden = new ImGearRasterPage(imageWidth, imageHeight, new ImGearColorSpace(ImGearColorSpaceIDs.RGBA), new int[] { 8, 8, 8, 8 }, true); // For Each Pixel for (int x = 0; x < imageWidth; ++x) { for (int y = 0; y < imageHeight; ++y) { // Copy Pixel ImGearPixel s = mergedImage.DIB.GetPixelCopy(x, y); ImGearPixel p = new ImGearPixel(4, 8); //For Each Channel for (int c = 0; c < 3; ++c) { // Get Low bit bool bit = (s[c] & (1 << 0)) != 0; // Set to Either 1 or 0 Followed by 7 0s if (bit) { p[c] = 128; //10000000 } else { p[c] = 0; //0000000 } } // Keep Alpha Channel Intact p[3] = 255; // Set the Pixel hidden.DIB.UpdatePixelFrom(x, y, p); } } // Return Extracted Image return(hidden); }