Thanks to visit codestin.com
Credit goes to Github.com

Skip to content

jpenrici/PNG_to_SVG

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 

Repository files navigation

PNG_to_SVG

A project that converts PNG images to SVG format by mapping each pixel into a colored rectangle.
In this algorithm, the PNG file is loaded, processed and exported as SVG for use in graphics editors.


Project Structure

PNG_to_SVG/
├── include/
│   ├── png2svg.h
│   └── svgToolBox.hpp
├── src/
│   ├── png2svg.cpp
│   └── main.cpp
├── images/
│   └── test.png
└── CMakeLists.txt

Requirements

  • CMake 3.20+
  • A C++23 compatible compiler (e.g., GCC 13+, Clang 16+, MSVC 2022+)
  • Zlib (for image decompression)

Building

mkdir build
cd build
cmake ..
cmake --build .

How It Works

  • The program loads a PNG file (Resources/image.png).
  • It reads the image pixel by pixel.
  • Each pixel is translated into an SVG with the corresponding color.
  • Fully transparent pixels are ignored.
  • The generated file output.svg preserves the color pattern of the input image.

Usage

Simply run the executable:

./png2svg png=<input.png> svg=<output.svg>

References

SVG : Documentation with W3C details and specifications.
PNG : Documentation with W3C details and specifications.
ZLIB : Library that implements the Deflate compression method.


License

This project is provided for educational purposes.
Free to use, modify, and expand with proper attribution.


Display

Result seen in Inkscape.

display

About

Experience with PNG and SVG files.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published