StanAngeloff / compass-magick

Dynamic image generation for Compass using ChunkyPNG/PhantomJS.
http://StanAngeloff.github.com/compass-magick/
Other
157 stars 4 forks source link

perpixel operations #7

Open boomyjee opened 13 years ago

boomyjee commented 13 years ago

i think it will be nice to have layer mixing like in PS

for example magick_effect('multiply', another_canvas) results in perpixel multiplication also you can use canvas as adjust for other effects like fade,brightness, etc.

multplication can be achieved in some way (though it's performance weak):

        magick_canvas(300,300, 
            magick_fill(#000) 
        )
        magick_canvas(300,300,
            magick_canvas('some_pic.png')
            magick_mask(magick_canvas($assets+"textures/fabric.png"))
        )

results in masking some picture with mask and blending with black a = brightness, so res = (1-a)_black + a_tex

but other effects can be done via ruby code

boomyjee commented 13 years ago

that's my current version of multiply shortcut

@function magick_multiply($c1,$c2) {
    @return
        magick_canvas($c1,
            magick_fill(
                magick_canvas($c2,
                   magick_fill(#000)
                   magick_mask($c2)
                )
            )
        );
}
StanAngeloff commented 13 years ago

Very interesting idea. I'd like to get some sort of blending option available in magick-compose, but I am short on tutorials. I'll keep this issue around and try and dig up the source in RMagick where they do vivid light, hard compose, etc.

boomyjee commented 13 years ago

what was the point switching from rmagick? it's capable doing lots of stuff that you are writing on your own and it's faster than chunkypng

StanAngeloff commented 13 years ago

what was the point switching from rmagick?

Last I checked the project wasn't actively maintained, it was a pain in the bum to set up (near impossible on Windows and virtually no support for Cygwin), it also lacks solid support for per-pixel manipulation and the APIs were/are a big mess.

The authors seem to be abandoning the project as well so it was time for Compass Magick to move on. ChunkyPNG was definitely the right choice, although performance suffers a lot and everything has to be done from scratch. It's not a big price to pay for a native-Ruby solution with no external dependencies.

I have plans for optimising the code in the future and also to utilise extreme caching, hopefully I'll manage to implement something proper soon.