> ## Content Index
> Fetch the complete content index at: https://cms.yufeiran.com/llms.txt
> Use this file to discover other available public pages before exploring further.

# Image Processing Program
- URL: https://cms.yufeiran.com/en-tu-xiang-chu-li-cheng-xu/
- Published: 2022-04-03T16:57:04.000Z
- Updated: 2026-09-27T12:37:58.000Z
- Author: Feiran Yu
- Tags: #lang-en, #legacy-import

## Background

After I was admitted to graduate school, my advisor gave me part of an image-processing industry project as practice. The project came from an outdoor poster company.

## Problems

The main requirements were:

1. Generate PDFs from huge images.
2. Given a polygon and a spacing value `d`, generate a new polygon expanded outward by distance `d`.

## Solutions

### 1\. Generate PDFs from huge images

Study the PDF file format, and try either writing a PDF generation module by myself or using existing libraries such as libHaru or PDFWriter.

PDFWriter was used to implement cropping.

### 2\. Generate an outward-offset polygon from a given polygon and spacing `d`

This is probably computational geometry. Since I had not studied it before, I first bought [Computational Geometry: Algorithm Analysis and Design](https://book.douban.com/subject/3151802/?ref=cms.yufeiran.com).

Edge-degeneration cases also need to be considered. References:

[Polygon offset and fill algorithm](https://www.jianshu.com/p/8c7e7c1afcb6?ref=cms.yufeiran.com)

[ClipperLib usage notes](https://codeantenna.com/a/LjhsuBxu3x?ref=cms.yufeiran.com)

### 3\. A GUI may be needed for user friendliness

QT / Dear ImGui / wxWidgets

## Notes

DPI means Dots Per Inch.

1 inch = 2.54 cm

100 DPI = 100 Dots Per Inch = 100 / 2.54 Dots Per Cm = 39.37 Dots Per Cm

## Reference Links

[Compiling and using LibHaru](https://www.cnblogs.com/nightnine/p/8947379.html?ref=cms.yufeiran.com)

[Compiling libharu on Windows 10](https://blog.csdn.net/weixin%5F38636815/article/details/116133677?ref=cms.yufeiran.com)

[Offsetting or shrinking polygons and contours by equal distance](https://blog.csdn.net/hjk61314/article/details/82112610?ref=cms.yufeiran.com)

[Using wxWidgets binaries directly in Visual Studio 2019](https://blog.csdn.net/libeiqi1201/article/details/120098716?ref=cms.yufeiran.com)

[wxWidgets wiki](https://wiki.wxwidgets.org/Main%5FPage?ref=cms.yufeiran.com)

[Image processing: pixel-coordinate matrix transforms, including translation, rotation, scaling, and shearing](https://blog.csdn.net/Jarlen/article/details/44877961?ref=cms.yufeiran.com)

[Determining whether a plane polygon is convex or concave](https://blog.csdn.net/swety%5Fgxy/article/details/70176512?ref=cms.yufeiran.com)