stumpy_core icon indicating copy to clipboard operation
stumpy_core copied to clipboard

stumpy_jpg

Open drujensen opened this issue 7 years ago • 9 comments

@l3kn Thanks for the great library! Anyone working on a JPG version?

drujensen avatar Jun 17 '18 16:06 drujensen

I'm glad you like it!

As far as I know there is no jpg version, probably because the format is (much?) more complicated than png.

The jpg loader for https://github.com/PistonDevelopers/image seems to be ~3k LOC long, implementing one in crystal could be a nice medium-size project.

Would you be interested in working on something like that? At the moment I don't have the time to do it by myself, but I could open up a shared “work in progress” repo and contribute smaller parts from time to time.

l3kn avatar Jun 17 '18 16:06 l3kn

While this is still a bit fresh, and going somewhat further into madness, do you know of any efforts to build an SVG renderer in Crystal? I've just started experimenting with it half-heartedly (due to immense frustration with both PhantomJS and Batik recently), but it's my first bit of Crystal and will probably be a disaster. :rocket: So I'd be keen to hear of similar efforts.

DestyNova avatar Aug 05 '18 23:08 DestyNova

As far as I know there are no such projects.

If your goal is to render arbitrary svg images into some pixel based format, I'd imagine it to be very hard because of some of the more advanced features in the svg sepecification, e.g.

  • Filters with simulated light sources & reflections
  • Stylesheets that need to be parsed and applied in the correct order
  • Fonts could be possible using some C library, but parsing formats like .otf and rendering them is complicated

What do you want to build on top of that renderer? If you only need a subset of the features, building something like https://github.com/fogleman/gg in crystal could be a nice alternative.

l3kn avatar Aug 06 '18 07:08 l3kn

Thanks @l3kn, you're right that it's a very big specification. My original use-case was converting an Impress animated presentation into something that could be added to a video, but the closest export format seems to be SVG 1.2. After many hours of experimentation with PhantomJS's renderer (jerky) and the Java Batik library (a mess of excessive abstractions), I decided to try writing the simplest possible program in Crystal that would convert an SVG animation into a stream of PNGs. It's more of a learning experiment than anything else, but you're right to point out the large number of difficult steps :mountain: Even if it goes nowhere I'll be glad to get some experience with Crystal since it feels quite nice so far!

[update] D'oh! After examining the SVG 1.2 format a bit more, I'm seeing that it can (and in my case, does) include Javascript that controls everything. That might be a step too far for me :rofl: but certainly the basic shapes should be doable.

DestyNova avatar Aug 06 '18 16:08 DestyNova

Just use Cairo or Qt

oprypin avatar Aug 06 '18 17:08 oprypin

I've been working on a stumpy_jpeg shard, but at the moment it only supports reading. https://github.com/reiswindy/stumpy_jpeg

reiswindy avatar May 17 '19 17:05 reiswindy

That's awesome, I'm happy to see people are still working on this.

Let me know if you want to be added to the stumpy_cr github organization, then all the projects are in one place.

Of course you'd keep the full control over your code and get all the permissions you want.

l3kn avatar May 17 '19 19:05 l3kn

That would be great! There's still some changes I would like to make before that's done though. Would that be fine?

reiswindy avatar May 24 '19 16:05 reiswindy

Sure, take your time. You should be able to create a new repository here once you're done

l3kn avatar May 24 '19 17:05 l3kn