Jump to content
Tommi Prami

"Png to pixel-perfect svg conversion" (I didn't make this)

Recommended Posts

Hello.

Coworker made this: https://github.com/TextEditorPro/Png2Svg

Kind of brute force Png to Svg conversion.

Depenging on the case, this might be good first step to the using Svg-icons in your project.

Like you don't mind if files are bit bigger . Or you have single size bitmaps which get resampled for different  sizes and the blurryness really bugs you.

-Tee-

Edited by Tommi Prami
Typo fixed
  • Like 4

Share this post


Link to post

And...

I bet Lasse will accept pull requests, if you find a way to make it better. 

I would bet that some algorithm to analize color and/or tranparency cradients would make way smaller Svg-files.  For me the vector graphics always has been ppure magic, but would guess, that som e cases those gradients would be possible to analyze to furher optimize the file... Molst likely justr rectangles with gradients would be goodf addition... 

-Tee-

Share this post


Link to post

What's the use case for this? I mean what problem does it solve?

 

Given that it just converts pixels to vector rectangles I don't really see the point.

The blurriness you get when upscaling a bitmap is by design. You can just use another resampling method if the blur is a problem.

 

(Just thinking out loud, so to speak; I understood that you aren't the author)

Share this post


Link to post
2 minutes ago, Anders Melander said:

What's the use case for this? I mean what problem does it solve?

 

Given that it just converts pixels to vector rectangles I don't really see the point.

The blurriness you get when upscaling a bitmap is by design. You can just use another resampling method if the blur is a problem.

 

(Just thinking out loud, so to speak; I understood that you aren't the author)

At least we have blurriness problem. And resulted pixel svg stays grispier.

But anyones mileage will definetely wary, if your exe is 150mb and if ypu make it 151mb, it is not big of a deal.  If visual appearance is better. 

Have not checked that is resampling methods of Delphi virtual image list adjustable... Havent heard anything of such, I think.

For use this could be good way to go forward. Not sure yet. Way better than trying to learn vector graphis and redrawing all aboiut 300 icons to svg, or paying graphic artist to do it for us. Most likely would cost 10k€ etc... I would not even think doing that for less :classic_biggrin: 

Because we need quite many custom icons thaty are not available in any collections. 

-Tee-

Share this post


Link to post
36 minutes ago, Anders Melander said:

What's the use case for this? I mean what problem does it solve?

My personal rationale is that you can onece and for all change icon technology/source from bitmap to vectorm and with for us, acceptable result.

After that one can start pondering how to get better and way more optimal Svg-files.

Anyhow, fully understanmd that this is not for even close good enough for all.

-Tee-

Edited by Tommi Prami
  • Like 1

Share this post


Link to post
1 hour ago, Tommi Prami said:

you can onece and for all change icon technology/source from bitmap to vectorm and with for us, acceptable result.

Fair point.

 

FWIW, I doubt that the method it uses can be improved much; Small color bitmaps often employ techniques such as unconscious inference, color psychology, and patterns to trick the brain into producing a better image than what would normally be possible given the available pixels.

Larger bitmaps is another story.

Share this post


Link to post
14 hours ago, Anders Melander said:

Fair point.

 

FWIW, I doubt that the method it uses can be improved much; Small color bitmaps often employ techniques such as unconscious inference, color psychology, and patterns to trick the brain into producing a better image than what would normally be possible given the available pixels.

Larger bitmaps is another story.

Lasse made new algorithm yesterday, and said that in his tests file size dropped about 50%

Have not tested my self...

Share this post


Link to post
21 hours ago, Anders Melander said:

Can you ask him what he did? I can't decipher it from the commit diff. The algorithm appears unchanged though.

Added Paths, instead of rectangles etc...

-Tee-

  • Like 1

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×