Skip to content

Instantly share code, notes, and snippets.

View kennytrytek-wf's full-sized avatar

Kenny Trytek kennytrytek-wf

  • Workiva
  • Ames, IA
View GitHub Profile
@kennytrytek-wf
kennytrytek-wf / Image-Printer.md
Last active October 8, 2025 20:28
Split tall or wide images into files that can be printed. Good for infographics. AI-generated :D

Image Printer

A Python script that takes an image file and splits it into printable 8.5x11 inch pages.

Features

  • Automatic orientation detection: Uses landscape orientation for wide images, portrait for tall images
  • Smart scaling: Scales down large images to fit page dimensions while maintaining aspect ratio
  • Page splitting: Divides scaled images into page-sized pieces in collated reading order
  • High-quality output: Generates 300 DPI JPEG files suitable for printing
package crashreportprocessor
import (
"context"
"encoding/json"
"fmt"
"go.opentelemetry.io/collector/component"
"go.opentelemetry.io/collector/consumer"
"go.opentelemetry.io/collector/pdata/pcommon"