Page 1 of 1

Text on image - Replicating old film camera data backs

Posted: 2013-08-17T12:08:57-07:00
by vmiceli
Hello folks,

I'm trying to replicate the look of the date and time that was imprinted on the old film SLRs with data back. They printed with a red lamp that left a glowing text on the photo.

My idea is to take the exif data and print date and time in a red text with a bit of blur to make it glow.

The code I'm debugging is below.

I'm writing the text to a transparent image that has the same size of the original, then I blur it then I composite it with the original.

The problem I have is: Once I composite the original and the text, I get a text that is not very bright. If on the other end I just flatten the transparent image on its own the text is very bright, so I guess the composite is not working as I intended. I think it may have something to do with the way I generate the alpha channel image?

Do you guys know what's wrong?

@echo off
CLS
SETLOCAL

:: Get image size:
FOR /F %%L IN ('identify -format "Width=%%w\nHeight=%%h" %1') DO set %%L


:: Get year/month/day and time separately
FOR /F "tokens=1,2,3,* delims=: " %%A IN ('identify -format "%%[EXIF:DateTimeOriginal]" %1') DO (set year=%%A & set month=%%B & set day=%%C & set time=%%D)

echo.
echo Year %year%
echo Month %month%
echo Day %day%
echo Time %time%

::Set a pointsize based on image size based on the shorter side of the picture (1/20th)
FOR /F %%i IN ('identify -format "%%[fx:min(w,h)/20]" %1') DO SET psize=%%i

echo.
echo PointSize Calculated is %psize%

:: Creates the offsets for the annotate position. The offsets are 1/30th on the long side and 1/20th on the short side
if %width% GTR %height% (
set /A AnnotateOffsetX=%width%/30
set /A AnnotateOffsetY=%height%/20

) else (
set /A AnnotateOffsetX=%width%/20
set /A AnnotateOffsetY=%height%/30

)
:: This is just the text picture and it looks nice and bright (font_fuzzy.jpg)
convert -size %width%x%height% xc:transparent -font DS-Digital -fill red -pointsize %psize% -strokewidth 2 -gravity southeast -annotate +%AnnotateOffsetX%+%AnnotateOffsetY% "%year%/%month%/%day% %time%" -blur 0x5 font_fuzzy.jpg

:: Here I create a transparent image with the same text as above to be combined with the original on a later step. (Alpha_Date.png)
convert -size %width%x%height% xc:transparent -font DS-Digital -fill red -pointsize %psize% -gravity southeast -annotate +%AnnotateOffsetX%+%AnnotateOffsetY% "%year%/%month%/%day% %time%" -channel RGBA -blur 0x5 Alpha_Date.png

:: Here I composite the two images, the Result.jpg has the text but is very dull, nothing like what it looks like in font_fuzzy.jpg.
composite -compose Dst_Over %1 Alpha_Date.png Result.jpg

Re: Text on image - Replicating old film camera data backs

Posted: 2013-08-17T12:11:51-07:00
by fmw42
It might help to see your output images. You can post them to some free image hosting service (dropbox, etc) and then put links here.

It would also help to know your IM version.

See also http://www.imagemagick.org/Usage/fonts/#neon

or my bash unix script colorglow at the link below

Re: Text on image - Replicating old film camera data backs

Posted: 2013-08-17T12:45:42-07:00
by vmiceli
Thanks Fred,

I'm using ImageMagick-6.8.6-8 on Windows 7.

The look of the text is as follows:

This is the text on its own written to a jpg:
https://www.dropbox.com/s/tbdx5o7xnfnnm ... y_crop.jpg

If I create the above in a transparent layer and combine with original I get the much less appealing:

https://www.dropbox.com/s/nevqw86d5kjl4 ... t_crop.jpg

I'll have a look at the link you mentioned too.

Vincenzo

Re: Text on image - Replicating old film camera data backs

Posted: 2013-08-17T12:47:53-07:00
by snibgo
Without looking at the detail, I'll comment that "red" isn't very light. It might be better with a colour like rgb(100%%,65%%,50%%).

Re: Text on image - Replicating old film camera data backs

Posted: 2013-08-17T14:08:14-07:00
by fmw42
If I create the above in a transparent layer and combine with original I get the much less appealing:
It looks as if you red is not fully opaque anywhere due to the blur affecting the inside of the text as well as the outside. To keep the blur to the outside of the text use something like

-blur radiusx65000 -level 0x50%

This produces a linear blur of radius and then forces 50% linearly to 100% opacity.

You can try using -blur 0xsigma -level 0x50%, but that blur will not be linear and you may want to adjust the 50% to something else.

Re: Text on image - Replicating old film camera data backs

Posted: 2013-08-18T08:18:20-07:00
by vmiceli
Thanks a million Fred, you are correct, the red text wasn't opaque enough. Your settings made it work. I need to fine tune the numbers to get the blur to produce a noticeable effect though.

Thanks!

Vincenzo