Adding text to a RAW - General Help and Assistance on using CHDK stable releases - CHDK Forum supplierdeeply

Adding text to a RAW

  • 3 Replies
  • 1598 Views
Adding text to a RAW
« on: 12 / October / 2023, 18:01:00 »
Advertisements
@reyalp


I’m sure I’ve asked you this before, so forgive me if I have.


Is there a way to add a text string to an image?


My use case is to add text to the first and last images of a bracket set, ie the bookends of a bracket set.


The two images with text on them need not be RAWs, ie they could be DNGs or JPEGs, but when ingested into Lightroom, say, I would wish them to be displayed contiguously with my bracket set RAWs.


Cheers


Garry

*

Offline reyalp

  • ******
  • 14086
Re: Adding text to a RAW
« Reply #1 on: 12 / October / 2023, 19:15:18 »
You can modify the raw image data before it's saved or a jpeg is created using rawop https://chdk.fandom.com/wiki/Lua/Raw_Hook_Operations

There is currently no functions for drawing text, so you'd have to roll your own with set_pixel.

Providing a way to re-use CHDK fonts was on my list of things to add some day, but I'm not sure anyone other than me has ever used this feature, so I haven't felt much need to add enhancements...
Don't forget what the H stands for.

Re: Adding text to a RAW
« Reply #2 on: 13 / October / 2023, 02:20:04 »
Many thanks for the info, I’ll certainly be looking to exploit being able to draw coloured rectangles.


As I said, my use case is to enable the functionality in my scripts to record info on my bracketing info, which can be complex, eg
  • Dark Frame to differentiate start of overall bracketing set
  • Bracket focus set
  • Dark Frame to differentiate start of simulated ND bracketing set at infinity
  • ND bracket set
  • Dark Frame to differentiate end of ND bracket set
  • Dark Fran to differentiate end of overall bracketing set
At least, if things work out, I should be able to add colour to add info to the dark frames.

Ideally I would like to add text info to a dark frame, eg capturing the info in the bracket set. This will be especially useful when I’m exposure and ND bracketing with a manual lens, ie limited EXIF data.

Cheers

Garry
« Last Edit: 13 / October / 2023, 02:23:14 by pigeonhill »

*

Offline reyalp

  • ******
  • 14086
Re: Adding text to a RAW
« Reply #3 on: 13 / October / 2023, 03:29:53 »
Many thanks for the info, I’ll certainly be looking to exploit being able to draw coloured rectangles.
Yes, if you can use simple shapes (like green square = start, red = end or whatever) as indicators, you wouldn't have write a whole text rendering system. If you can live with just numbers, something akin to a seven segment display could also be a useful intermediate option.

CHDK/SCRIPTS/TEST/rawdraw.lua gives an example of the required hook setup and drawing functions.
Don't forget what the H stands for.


 

Related Topics


SimplePortal 2.3.6 © 2008-2014, SimplePortal