blurred shadow on images?
![](https://secure.gravatar.com/avatar/5a39f1335b6eff433673ed987859fb24.jpg?s=120&d=mm&r=g)
I'd like to place some plain photos rotated (say 12°) and with a blurred shadow above some colored elements, i.e. the shadow must use transparency. I guess I could get such using ImageMagick, but is there a possibility using ConTeXt or one of its favourite friends? I'd prefer a solution that works with CMYK data. If there isn't - is the transparency of PNG usable? Since all of the pictures will have almost the same size, I could probably also use the shadow as a single PDF picture and place that behind with a small offset. Greetlings from Lake Constance! Hraban --- http://www.fiee.net/texnique/ http://wiki.contextgarden.net https://www.cacert.org (I'm an assurer)
![](https://secure.gravatar.com/avatar/565476157eb3895a9c928ffce26d988d.jpg?s=120&d=mm&r=g)
Henning Hraban Ramm wrote:
I'd like to place some plain photos rotated (say 12°) and with a blurred shadow above some colored elements, i.e. the shadow must use transparency. I guess I could get such using ImageMagick, but is there a possibility using ConTeXt or one of its favourite friends? I'd prefer a solution that works with CMYK data.
Creating a semi-transparent backdrop with metapost is quite simple, but I am not sure whether that works with cmyk, you'll have to try yourself. Code goes something like this: \startuniqueMPgraphic{texthole} for dx = 0 upto 40: dy := dx; wa := 10 + dx; wb := \overlaywidth - dx - 10; ha := dy + 10; hb := \overlayheight - dy - 10; fill (wa,ha)--(wb,ha)--(wb,hb)--(wa,hb)--cycle withcolor transparent("normal", .04,white); endfor; \stopuniqueMPgraphic
If there isn't - is the transparency of PNG usable?
Sure, and may use less resources than mp drawings, but that is definitely RGB Best wishes, Taco
![](https://secure.gravatar.com/avatar/5a39f1335b6eff433673ed987859fb24.jpg?s=120&d=mm&r=g)
Am 2010-06-21 um 08:42 schrieb Taco Hoekwater:
Henning Hraban Ramm wrote:
I'd like to place some plain photos rotated (say 12°) and with a blurred shadow above some colored elements, i.e. the shadow must use transparency. I guess I could get such using ImageMagick, but is there a possibility using ConTeXt or one of its favourite friends? I'd prefer a solution that works with CMYK data.
Creating a semi-transparent backdrop with metapost is quite simple, but I am not sure whether that works with cmyk, you'll have to try yourself. Code goes something like this:
Thank you, I'll try. Seems like I should learn MetaPost finally...
If there isn't - is the transparency of PNG usable?
Sure, and may use less resources than mp drawings, but that is definitely RGB
Yes, of course. Since I only need to output on a color laser printer, it will probably work. Processing time matters. Greetlings from Lake Constance! Hraban --- http://www.fiee.net/texnique/ http://wiki.contextgarden.net https://www.cacert.org (I'm an assurer)
![](https://secure.gravatar.com/avatar/5a39f1335b6eff433673ed987859fb24.jpg?s=120&d=mm&r=g)
Am 2010-06-21 um 08:42 schrieb Taco Hoekwater:
Creating a semi-transparent backdrop with metapost is quite simple, but I am not sure whether that works with cmyk, you'll have to try yourself. Code goes something like this:
For the records: This is, how I'll use it: \startuniqueMPgraphic{texthole} for dx = 0 upto 40: dy := dx; wa := 10 + dx; wb := \overlaywidth - dx - 10; ha := dy + 10; hb := \overlayheight - dy - 10; fill (wa,ha)--(wb,ha)--(wb,hb)--(wa,hb)--cycle withcolor transparent("normal", .04, black); endfor; \stopuniqueMPgraphic \defineoverlay[shaded][\useMPgraphic{texthole}] \starttext \rotate[rotation=12]{% \framed[height=50mm, width=50mm, frame=off, background=shaded, backgroundoffset=5mm, align=middle]% {\offset[x=1mm,y=-2mm]{\externalfigure[koe][width=50mm]}}% } \stoptext I'm glad I found \offset, because framed's offset parameter can't distinguish x and y offset. Positive offset moves right and down, negative offset moves just up - I guess that's a buglet. Greetlings from Lake Constance! Hraban --- http://www.fiee.net/texnique/ http://wiki.contextgarden.net https://www.cacert.org (I'm an assurer)
![](https://secure.gravatar.com/avatar/93131e1e6e2204bd13501390d768dbdc.jpg?s=120&d=mm&r=g)
Am 30.06.10 14:39, schrieb Henning Hraban Ramm:
Am 2010-06-21 um 08:42 schrieb Taco Hoekwater:
Creating a semi-transparent backdrop with metapost is quite simple, but I am not sure whether that works with cmyk, you'll have to try yourself. Code goes something like this:
For the records: This is, how I'll use it:
\startuniqueMPgraphic{texthole} for dx = 0 upto 40: dy := dx; wa := 10 + dx; wb := \overlaywidth - dx - 10; ha := dy + 10; hb := \overlayheight - dy - 10; fill (wa,ha)--(wb,ha)--(wb,hb)--(wa,hb)--cycle withcolor transparent("normal", .04, black); endfor; \stopuniqueMPgraphic
\defineoverlay[shaded][\useMPgraphic{texthole}]
\starttext
\rotate[rotation=12]{% \framed[height=50mm, width=50mm, frame=off, background=shaded, backgroundoffset=5mm, align=middle]% {\offset[x=1mm,y=-2mm]{\externalfigure[koe][width=50mm]}}% }
\stoptext
I'm glad I found \offset, because framed's offset parameter can't distinguish x and y offset. Positive offset moves right and down, negative offset moves just up - I guess that's a buglet.
You can change the boundingbox in the metapost graphic (the white background was required for the cow figure because it has a transparent background) \startuniqueMPgraphic{shadow} for dx = 0 upto 40: dy := dx ; wa := dx - 10 ; wb := \overlaywidth - dx + 10 ; ha := dy - 10 ; hb := \overlayheight - dy + 10 ; fill (wa,ha)--(wb,ha)--(wb,hb)--(wa,hb)--cycle withcolor transparent("normal", .04, black); endfor; setbounds currentpicture to OverlayBox ; \stopuniqueMPgraphic \defineoverlay[shadow][\useMPgraphic{shadow}] \starttext \externalfigure[cow][width=50mm,background={shadow,color},backgroundcolor=white] \stoptext Wolfgang
![](https://secure.gravatar.com/avatar/5a39f1335b6eff433673ed987859fb24.jpg?s=120&d=mm&r=g)
Am 2010-06-30 um 22:47 schrieb Wolfgang Schuster:
You can change the boundingbox in the metapost graphic (the white background was required for the cow figure because it has a transparent background)
Thank you! I used an opaque picture for my tests. I played a bit with different shapes, I like my rounded rectangle best: \startuniqueMPgraphic{mpshadow} ox := -7 ; % offset x oy := -7 ; % offset y bx := 5 ; % bleed x by := 5 ; % bleed y rx := 7 ; % corner radius x ry := 7 ; % corner radius y for dx = 0 upto 40: dy := dx ; xa := dx + ox - bx/2; xb := \overlaywidth - dx + ox + bx/2; ya := dy + oy - by/2; yb := \overlayheight - dy + oy + by/2; % % rectangle % fill (xa,ya)--(xb,ya)--(xb,yb)--(xa,yb)--cycle % withcolor transparent("normal", .04, black) ; % rounded rectangle fill (xa, ya + ry)--- (xa, yb - ry).. (xa + rx, yb)--- (xb - rx, yb).. (xb, yb - ry)--- (xb, ya + ry).. (xb - rx, ya)--- (xa + rx, ya)..cycle withcolor transparent("normal", .04, black) ; % % super ellipse % hx := xb / 2; % hy := yb / 2; % fill (xa + rx, ya + ry)... % (xa, ya + hy)... % (xa + rx, yb - ry)... % (xa + hx, yb)... % (xb - rx, yb - ry)... % (xb, ya + hy)... % (xb - rx, ya + ry)... % (xa + hx, ya)...cycle % withcolor transparent("normal", .04, black) ; endfor; setbounds currentpicture to OverlayBox ; \stopuniqueMPgraphic \defineoverlay[shadow][\useMPgraphic{mpshadow}] \starttext \rotate[rotation=12]{% \externalfigure[koe][width=50mm,background=shadow] } \stoptext Greetlings from Lake Constance! Hraban --- http://www.fiee.net/texnique/ http://wiki.contextgarden.net https://www.cacert.org (I'm an assurer)
participants (3)
-
Henning Hraban Ramm
-
Taco Hoekwater
-
Wolfgang Schuster