# Graphics Mill Code Samples > C# examples for image processing with Graphics Mill, organized by topic. Browse a topic to find a sample. Append `_md` to a sample's HTML URL to read its Markdown representation. Sample Markdown includes the instruction, usings, code, explanation, tags, input/output files, and links to Used APIs when available. The catalog, topic folders, and tag listings also have Markdown representations. Used API links lead to Markdown reference documentation. ## Catalog - [Browse all samples](): Topic folders and tag navigation. - [Complete XML catalog](): Structured examples for searching across the full collection. ## Topics - [Codecs](): Samples demonstrating basic image encoding and decoding across supported formats. Shows how to read from and write to files and streams, and perform simple format transcoding. Includes minimal, focused examples suitable for integration into a pipeline API. - [ColorManagement](): These samples demonstrate working with color profiles and color spaces, including converting between CMYK, RGB, LAB, and Grayscale with and without color management. They cover assigning and retaining embedded ICC profiles, proofing with destination and target device profiles, and reading profile metadata without decoding full images. Channel operations such as adding, removing, splitting, and combining alpha and color channels are included, along with spot colors and extra channel handling. - [Drawing](): These samples demonstrate drawing primitives, text, and images using brushes and pens, and working with paths, clipping, and transformations. - [Interoperability](): These samples focus on interoperability with other .NET components and frameworks. They demonstrate exchanging image data with WPF (\`BitmapSource\`/\`WriteableBitmap\`) and System.Drawing, working through streams and byte arrays, and plugging in custom readers or writers when needed. - [Metadata](): These samples show how to read and write image metadata, including EXIF, IPTC, XMP, and Adobe image resource blocks. They demonstrate preserving metadata during conversions and resizes, as well as performing lossless updates in formats like JPEG and TIFF. Examples cover extracting and embedding thumbnails and working with clipping paths stored as metadata. You can also access metadata without decoding full bitmaps and map fields to strongly typed structures where available. - [Pipeline API](): These samples focus on processing very large images efficiently using streaming pipelines that avoid loading full bitmaps into memory. They demonstrate stripe‑based processing, splitting images into tiles, and composing flows with multiple sources and receivers. Scenarios include resizing, rotating, and cropping in a memory‑friendly way, tracking progress, and supporting cancellation for long‑running jobs. - [PSD format](): These samples demonstrate how to work with Adobe Photoshop (PSD) files. Topics include accessing layers, masks, and channels; reading visibility and blending modes; and extracting raster content as needed. - [Text](): These samples showcase various text rendering capabilities, including alternate layouts, multi-frame text flow, and color effects. - [Transforms](): These samples demonstrate common image transforms and filters including resize, rotate and flip, crop, and color or tone adjustments. They include brightness/contrast changes, tinting, bezier-based operations, and minimum/maximum/median filters for simple noise reduction. ## Samples ### Codecs - [Add a tiled watermark to PDF pages](): Adds a semi-transparent, rotated tiled text watermark to every page of a PDF file. - [Add and remove pages in an existing PDF](): Rebuilds an existing PDF page by page, removing one page and inserting a new one. - [Combine multiple PDF files into one document](): Combines the pages of several existing PDF files into one multi-page PDF document. - [Compare Image Format Compressions](): Compare compression efficiency of WebP, JPEG, and PNG formats. - [Convert And Write JPEG](): Converts an image to 24bpp RGB format and saves it as a JPEG file. - [Convert Animated GIF Image To WebP](): Convert an animated GIF image to WebP format, preserving animation. - [Convert Clipping Path To TGA](): Converts a clipping path from a JPEG to an alpha channel and saves as TGA. - [Create a PDF/VT file with personalized business cards](): Creates a PDF/VT file with personalized business card records for a batch of recipients. - [Create a PDF/X-4 file with CMYK output intent](): Creates a PDF/X-4 file with CMYK output intent and color-managed images. - [Create Business Card](): Creates a business card layout and saves it as a PDF file. - [Create Multipage PDF](): Generates personalized multipage PDF invitations with variable data. - [Crop Jpeg Losslessly](): Performs a lossless crop on a JPEG image and saves the result. - [Draw On PDF With Spot Color](): Fills a rectangle with a PANTONE spot color in a PDF document. - [Draw Spot On CMYK](): Draws text and an image on a spot channel over a CMYK background in a PDF. - [Enum Container Elements](): Enumerate and print the elements of a graphics container from a PDF file. - [Flip Jpeg Losslessly](): Flips a JPEG image horizontally without recompression, preserving image quality. - [Lay out paragraphs, lists, and tab-aligned columns in a PDF](): Lays out paragraphs, a bulleted list, and a dot-leader tab-aligned schedule directly in a PDF. - [Load Multiframe Image](): Loads a multi-frame TIFF image and saves each frame as a separate JPEG file. - [Load Save Stream](): Loads an image from a stream, applies JPEG quality settings, and saves it to another stream. - [Overlay one PDF's graphics onto another](): Overlays the vector content of one PDF, a seal, onto every page of another PDF. - [PDF Layers](): Creates a PDF document with multiple visible and invisible layers. - [PDF To SVG](): Convert vector content from a PDF file to SVG format. - [Png NeuQuant Example](): Saves images to PNG using various bit depths, quantization, and dithering methods. - [Rasterize a PDF page two ways: quick vs. full control](): Compares PdfFrame.GetBitmap, a quick RGB24 preview, against GraphicsContainerRasterizer, which allows any pixel format and resolution. - [Read and Write JPEG](): Reads a JPEG image, flips it vertically, and saves it as a new JPEG with high-quality settings. - [Read and write PDF page boxes](): Defines print production page boxes (bleed, trim, art) on a 300 DPI PDF using UnitConverter, then reads them back with PdfReader. - [Read Animated Gif](): Reads all frames from an animated GIF and saves each as a separate file. - [Read Convert And Write TGA](): Reads a TGA image, converts it to 16-bit with RLE compression, and saves it. - [Read Extra Channel From TIFF](): Extracts an extra channel from a TIFF image and saves it as a new TIFF file. - [Read Image Metadata](): Reads EXIF and IPTC metadata from an image file without loading bitmap data. - [Read image with WPF](): Shows how to use a custom WPF image reader to pass an image into a processing pipeline. - [Read Multiframe TIFF](): Reads a multi-frame TIFF image and saves each frame as a JPEG file. - [Read Multiframe TIFF Memory Friendly](): Reads a multi-frame TIFF using a memory-friendly pipeline and saves each frame as JPEG. - [Read RAW Image](): Reads a RAW image file and saves it as a JPEG image. - [Read TIFF](): Reads the first frame of a TIFF image and saves it as a JPEG file. - [Recolor Red Strokes](): Detect and recolor red strokes in a graphics container. - [Recompress JPEG partially](): Applies a mosaic effect to a region of a JPEG image and updates only that region using partial recompression. - [Replace Process Color](): Converts a process color to a spot color and saves the result as a PDF. - [Resize Animated Gif](): Resizes an animated GIF to fixed dimensions while preserving animation properties. - [Resize while reading JPEG](): Resizes a JPEG image by a factor of 2 during decoding using the codec’s built-in scaling. - [Rotate JPEG losslessly](): Rotates a JPEG image 90 degrees clockwise without recompression, preserving quality. - [Save Multiframe Image](): Saves multiple images as frames in a single multipage TIFF file. - [Save Spot Image To PDF](): Creates an image with a spot color and saves it to a PDF file. - [Save Vector Content To JPEG](): Rasterize PDF vector content and save as JPEG. - [SVG To PDF](): Convert an SVG file to PDF format. - [TIFF Extra Channels To Spot Color Space](): Converts a TIFF with extra channels to a PDF using separation color space. - [Update JPEG metadata losslessly](): Updates JPEG metadata (IPTC, EXIF, XMP) without recompressing the image. - [Write Animated Gif](): Creates an animated GIF by generating frames with a moving green circle. - [Write Animated WebP](): Create a simple animated image in WebP format. - [Write bitmap to EPS](): Loads a JPEG image and saves it directly as an EPS file. - [Write Bitmap To PDF Memory Friendly](): Saves a JPEG image to PDF using a memory-friendly pipeline approach. - [Write Extra Channel](): Adds an extra alpha channel to a TIFF image using a grayscale bitmap. - [Write Extra Channel With Display Info](): Saves extra channels with display info to Adobe resources in a TIFF file. - [Write Extra Channel With Name](): Saves an extra channel with a custom name to a TIFF image using Adobe resources. - [Write image with WPF](): Demonstrates saving an image from a pipeline using a custom WPF image writer. - [Write Multiframe TIFF](): Create a TIFF file with multiple frames, each with its own compression. - [Write PNG Image](): Reads a JPEG image, flips it vertically, and saves it as a PNG file. - [Write raster and vector graphics to EPS](): Creates an EPS file with both a bitmap and vector graphics, including shapes and styled text. - [Write Raster And Vector Graphics To PDF](): Saves both raster and vector graphics to a PDF file with compression. - [Write Text To PDF](): Writes plain and round text as PDF text with embedded fonts. - [Write TGA](): Reads a JPEG image, flips it vertically, and saves it as a TARGA file. - [Write TIFF](): Convert a JPEG image to TIFF format with JPEG compression. - [Write WebP](): Convert a JPEG image to WebP format with quality settings. - [Write WebP Lossy And Lossless](): Save an image in both lossy and lossless WebP formats. ### ColorManagement - [Add Alpha Channel](): Adds an elliptical alpha channel to an image. - [Add Alpha Channel (Memory Friendly)](): Adds an elliptical alpha channel using a memory-friendly pipeline. - [Adjust Lightness (RGB)](): Adjusts image brightness by modifying all RGB channels. - [Adjust Lightness Lab](): Adjusts image brightness by modifying the Lab lightness channel. - [Assign a color profile to a bitmap](): Replaces the embedded color profile of an image with a new one. - [CMYK To CMYK Using Device Link Profile](): Converts a CMYK image to another CMYK color space using a device link profile. - [CMYK To RGB With Color Management](): Converts a CMYK color to RGB using color management. - [Color Proofing](): Converts a CMYK image to RGB for proofing using color profiles. - [Combine channels](): Combines image channels from multiple sources into one image. - [Convert CMYK to RGB](): Converts a CMYK image to RGB using color management. - [Convert colors using LittleCMS](): Convert an image's color space using LittleCMS. - [Convert To Indexed](): Converts an RGB image to an 8-bit indexed format with dithering and a custom palette. - [Get embedded profile](): Displays information about the embedded color profile in an image. - [Get embedded profile using memory-friendly Pipeline API](): Displays embedded color profile info using a memory-friendly pipeline. - [Preview RGB To CMYK On Screen](): Simulates CMYK color conversion and previews the result as it would appear on screen. - [Preview RGB To CMYK On Screen (Memory Friendly)](): Previews CMYK color conversion using a memory-efficient pipeline approach. - [Remove Alpha Channel](): Removes the alpha channel and replaces it with a solid color. - [Rgb To Cmyk color space conversion](): Converts an RGB image to CMYK with color management using the object-based API. - [Rgb To Cmyk Memory Friendly](): Converts RGB to CMYK with color management using a memory-friendly pipeline. - [RGB To CMYK Without Color Management](): Converts an RGB color to CMYK without color management. - [RGB To Lab With Color Management](): Converts an RGB color to LAB using color management. - [RGB To Lab Without Color Management](): Converts an RGB color to LAB without color management. - [Show Color Profile Information](): Displays detailed information about sRGB and ICC color profiles. - [Split channels](): Splits a CMYK image into separate channel files. - [Swap Channels](): Swaps color channels of an image, such as blue and green. - [Swap Channels Memory Friendly](): Swaps red and green channels using a memory-friendly pipeline. - [Transparentize](): Makes a specific color in the image transparent. ### Drawing - [Artistic Frame](): Create an artistic photo frame composition with multiple images and effects. - [Draw Path](): Draw vector shapes and styled text using a custom path. - [Draw With Clipping Path](): Draw an image within an elliptical clipping path. - [Matrix Transform](): Apply matrix transformations to graphics for drawing shapes and text. - [Overlay an Image onto Another Image](): Overlay a watermark image onto another image using advanced graphics. ### Interoperability - [Convert From WPF](): Convert a WPF BitmapFrame to a GraphicsMill Bitmap. - [Convert To WPF](): Convert a GraphicsMill Bitmap to a WPF BitmapSource. - [Hash From Bitmap](): Compute an MD5 hash from bitmap pixel data using unsafe scanline access. - [Preserve Color Profile And Metadata (System.Drawing Interop)](): Convert between GraphicsMill and System.Drawing bitmaps while preserving metadata and color profile. - [Process Non-RGB (System.Drawing Interop)](): Process non-RGB images for System.Drawing interop, preserving color and metadata. - [Simple Conversion (System.Drawing Interop)](): Convert between GraphicsMill and System.Drawing bitmaps for RGB images. ### Metadata - [Convert Clipping Path To Mask](): Converts a clipping path into an alpha channel mask for the image. - [Copy Clipping Path](): Copies all Adobe resources, including clipping paths, to a new JPEG. - [Copy Clipping Path (Memory Friendly)](): Copies clipping paths using a memory-efficient pipeline. - [Create Clipping Path](): Creates and embeds a clipping path from an SVG file into a JPEG image. - [Crop Image And Preserve Clipping Path](): Crops an image while preserving its clipping path. - [Get EXIF Thumbnail](): Extract and save the EXIF thumbnail from a JPEG image. - [Modify Clipping Path Explicitly](): Crops an image and updates its clipping path explicitly. - [Modify Clipping Path Explicitly (Memory Friendly)](): Modifies a clipping path and image using a memory-friendly pipeline. - [Process Complex EXIF Types](): Read and modify complex EXIF tags in a JPEG image. - [Read Clipping Path Flatness](): Reads and displays the name and flatness of a clipping path from a TIFF image. - [Read EXIF and IPTC](): Reads and displays EXIF and IPTC metadata from a JPEG image. - [Read XMP Metadata](): Reads and prints all XMP metadata properties from an image. - [Read XMP Property](): Reads and displays a specific XMP property from image metadata. - [Resize And Preserve Metadata](): Resizes a JPEG image and preserves or updates all metadata. - [Resize Image And Clipping Path (Memory Friendly)](): Resizes an image and its clipping path using a memory-efficient pipeline. - [Visualize Clipping Path](): Shows how to visualize and draw clipping paths on images for demonstration. - [Write Adobe Image Resource Block](): Write a copyright XMP block to an image using AdobeResourceBlock. - [Write EXIF and IPTC](): Writes custom EXIF and IPTC metadata to a JPEG image. - [Write EXIF and IPTC (Memory Friendly)](): Writes EXIF and IPTC metadata to a JPEG using a memory-friendly pipeline. ### Pipeline API - [Assemble Pipeline manually](): Shows how to manually assemble and run a simple image processing pipeline using receivers instead of the Pipeline class. - [Combine Channels](): Combines separate RGB channel images into a single full-color image. - [Conditionally adding pipeline elements](): Demonstrates how to add pipeline elements based on input image properties to create sRGB thumbnails with a specific DPI. - [Create linear pipeline](): Shows how to create a linear image processing pipeline using a simple and straightforward syntax. - [Create Vignette](): Creates a vignette effect with a specified color using advanced pipeline techniques. - [Crop](): Crop an image to a specified rectangle using the Pipeline API. - [Draw text watermark on thumbnail image](): Creates a thumbnail and draws a semi-transparent text watermark using transforms and drawing APIs. - [Draw Using Advanced Graphics](): Draw a rectangle on an image using advanced graphics in the Pipeline API. - [Multiple thumbnails](): Creates two thumbnails of different sizes from a single image read. - [Resize](): Resizes an image using a memory-friendly pipeline approach. - [Rotate](): Rotates an image using a memory-friendly pipeline approach. - [Split And Combine Channels](): Splits an image into RGB channels, adjusts brightness, and recombines them. - [Split Channels](): Splits RGB channels, adjusts their brightness, and saves each as a separate image. - [Using the OnInit event to configure pipeline elements](): Demonstrates configuring pipeline elements dynamically using the OnInit event to adjust settings based on input image data. ### PSD format - [Check PSD Features](): Validates PSD files to ensure only supported features are present. - [Check PSD Features With Output](): Generates a report listing unsupported features in a PSD file. - [Invert Background](): Inverts the background layer of a PSD image and saves the result as a PDF. - [Render Mug Preview](): Creates a 3D mug preview by processing a PSD file with a custom image. - [Replace Background](): Replaces the background image of a PSD file and saves the result as a PDF. - [Update Text](): Updates the text layer of a PSD image and saves the result as a PDF. - [Update Text And Shape Color](): Updates text and shape colors in a PSD image and saves the result as a PDF. - [Update Text Color](): Updates the text color in a PSD image and saves the result as a PDF. ### Text - [Art text](): Shows different types of art text effects using various styles. - [Autofit](): Fits the largest possible text inside a specified shape area. - [Bounded Text](): Draws text inside a specific rectangular area using bounded text. - [Colored Text](): Renders formatted, multi-colored text onto a bitmap image. - [Colored Watermark](): Applies a colored watermark to an image using a tiling brush and text rendering. - [Double Outline](): Draws text with a double outline effect and saves it as an image. - [Double Path Text](): Draws text along two custom paths using double path text. - [Draw Lists](): Draws formatted text with various types of ordered and unordered lists. - [Draw Paragraphs](): Draws multiple formatted text paragraphs with custom styles. - [Font API](): Renders text by drawing individual character outlines using a custom font. - [Font Fallback](): Draws multilanguage text with font fallback support for missing characters. - [Font Metrics](): Loads a custom font and displays its metrics and properties. - [Gradient Color](): Draws text with a gradient fill and saves it as an image. - [Path Bounded Text](): Draws text inside multiple bounding paths and wraps it around a custom path. - [Path Text](): Draws text along a custom path using a Bezier curve. - [Plain Text](): Demonstrates rendering of plain horizontal and vertical text. - [Reflected Text](): Creates a mirrored text effect and saves the result as an image. - [Show Custom Font Metrics](): Loads a custom font and visualizes its metrics and text layout. - [Subscript and Superscript](): Draws text with subscript and superscript formatting. - [Text Effects](): Applies shadow and glow effects to text rendering. - [Text Frames](): Renders text in multiple columns and along a curved path. - [Vertical Text](): Draws vertical text inside a shape and at a specific point on the canvas. - [Wrapping Paths](): Wraps text inside a rectangle, excluding regions defined by a wrapping path. ### Transforms - [Adjust Colors Using Lab](): Adjusts image colors by modifying Lab color channels. - [Adjust HSL](): Adjusts the hue, saturation, and lightness of an image. - [Apply LUT](): Applies a look-up table (LUT) correction to an image. - [Auto Brightness](): Automatically adjusts the brightness of an image. - [Auto Contrast](): Automatically adjusts the contrast of an image. - [Autorotate](): Rotates an image automatically using EXIF orientation metadata. - [Bezier Transform](): Applies a Bezier transformation to an image using control points. - [Brightness](): Adjusts the brightness of an image. - [Brightness Contrast](): Adjusts the brightness and contrast of an image. - [Channel Balance](): Adjusts the balance of color channels in an image. - [Contrast](): Adjusts the contrast of an image. - [Crop](): Crops an image to a specified rectangular region. - [Desaturate](): Converts an image to grayscale by removing color. - [Flip](): Flips an image vertically or horizontally. - [Levels](): Adjusts image levels using custom input and output values. - [Maximum](): Applies the Maximum filter to an image. - [Median](): Applies the Median filter to an image. - [Minimum](): Applies the Minimum filter to an image. - [Remove Green Screen](): Removes a green screen background from an image. - [Resize](): Resizes an image while maintaining its aspect ratio. - [Resize Sharp](): Resizes an image while preserving sharpness, similar to Photoshop's Bicubic Sharper. - [Rotate](): Rotates an image by 90, 180, or 270 degrees. - [Rotate Arbitrary](): Rotates an image by any angle with a specified background color. - [Tint Using Alpha](): Applies a tint to an image using the alpha channel. - [Tint Using Alpha (Memory Friendly)](): Applies a tint using the alpha channel with a memory-friendly pipeline approach. - [Tint Using Lab](): Applies a tint to an image by manipulating Lab color channels.