Adding text to JPEG images

Ask for help and post your question on how to use XnView MP.

Moderators: XnTriq, helmut, xnview

rnmerchant
Posts: 32
Joined: Wed Nov 04, 2020 2:05 am

Adding text to JPEG images

Post by rnmerchant »

I have been wondering about adding text to an image (useful, perhaps, with old historical family photos to identify people).

2 questions, perhaps not of great import. However.... Insofar as I understand every time one saves a JPG image the image is 'degraded' a bit further. Is this important enough an effect that one shouldn't use the 'add text' feature rather than using exif fields....? Mind you these images are just family interest and not particularly historically vitally important, so a small amount of degredation may not be that big a deal...

Bringing up the Text dialogue, it seems to default to MS Shell Dlg 2. This is a font I've never heard of. Is there anything important about this default?

Thx :|
cday
XnThusiast
Posts: 4185
Joined: Sun Apr 29, 2012 9:45 am
Location: Cheltenham, U.K.

Re: adding text to an image

Post by cday »

rnmerchant wrote: Tue Aug 15, 2023 10:25 pm I have been wondering about adding text to an image (useful, perhaps, with old historical family photos to identify people).

I understand every time one saves a JPG image the image is 'degraded' a bit further. Is this important enough an effect that one shouldn't use the 'add text' feature rather than using exif fields....? Mind you these images are just family interest and not particularly historically vitally important, so a small amount of degredation may not be that big a deal...
No reason for concern in any normal situation, but understand that the text added can't be edited or removed to restore the original image, so best to keep a copy of the original images if there is any possibility of needing to use them again.
Bringing up the Text dialogue, it seems to default to MS Shell Dlg 2. This is a font I've never heard of. Is there anything important about this default?
Use any font you think suitable... :D

Edit:

An option which might be worth considering would be to place the added text on new image canvas, for example below the image. When captioning a series of images the new canvas could often be added as a batch operation.

Advantages would include the text possibly being easier to read if placed on a white background rather than directly on the images, and the fact that if required the added text could be removed later by cropping the image, or for that matter replaced by new text if the existing text is first removed by pasting background colour over it.

Note, however, that whichever method is used good quality text will require that images have reasonable pixel dimensions, however when that is not the case there may be some possibility of resizing images to larger pixel dimensions by a factor such as two, if the quality of the resulting images is acceptable
User avatar
michel038
XnThusiast
Posts: 1408
Joined: Tue Sep 27, 2016 8:18 am
Location: France

Re: Adding text to JPEG images

Post by michel038 »

Another method :
- Install "Face tag" add-on ( https://www.xnview.com/wiki/index.php?t ... _Face_tags )
- ( you can enable settings>metadata>"Import xmp subject..." and "import xmp face tag" options to get "People" in categories filter up-to-date )
- Select images in Browser
- Metadata>Face tag
- Add names on people

To view names, open a photo in View mode
Enable "View>Show People's regions" option

Then you can get a screen capture with "Capture" tool, and save it as a copy of original.
LaurelHardy.jpg
.
You can use categories filter, People to find anyone in your tagged photos
You do not have the required permissions to view the files attached to this post.
Last edited by michel038 on Wed Aug 16, 2023 5:15 pm, edited 4 times in total.
User avatar
XnTriq
Moderator & Librarian
Posts: 6387
Joined: Sun Sep 25, 2005 3:00 am
Location: Ref Desk

Re: Adding text to JPEG images

Post by XnTriq »

  • BetterJPEG
    “BetterJPEG is a JPEG editor specifically designed to avoid recompression loss when editing and resaving JPEG images. BetterJPEG takes advantage of the fact that JPEG images consist of a number of small independent blocks and does not recompress blocks that don't have to be changed.”
  • RealWorld Photos
    “RealWorld Photos avoids the incremental quality loss caused by repeated .jpg re-saving.
    Unchanged areas of a photograph are not re-compressed during saving. They are taken directly from the original image. The whole process is completely transparent to the end user. It just works! You can even use layers and save the intermediate result in .rli format and still get the benefits of lossless re-saving when producing the final .jpg.”
    • Lossless JPEG Saving
      “A JPEG image is divided into tiles (called MCUs - minimum compression units) and each tile is processed separately. The size of the tiles is 8x8 pixels, but JPEG can save chrominance (hue) information at smaller resolution and therefore a 8x8 pixels of chrominance information can effectively affect for example 16x16 pixels.
      The JPEG codec in RW apps detects which tiles were not changed since the original JPEG image was opened and if such tiles are found, they are copied from the original image without any loss.”
  • XnView Forum
User avatar
Brother Gabriel-Marie
Posts: 286
Joined: Thu Aug 23, 2007 2:33 pm
Location: United States

Re: Adding text to JPEG images

Post by Brother Gabriel-Marie »

Adding text to images makes XnView an easy option for creating memes!
However, is it possible to have some extra features in that regard? Or do we have an addon for MP that will work?

Text Outlines - so we can use yellow letters over a white background
Drop Shadow - well, because everyone likes them and they make things easier to see

Those would be fabulous.
User avatar
Brother Gabriel-Marie
Posts: 286
Joined: Thu Aug 23, 2007 2:33 pm
Location: United States

Re: Adding text to JPEG images

Post by Brother Gabriel-Marie »

Oh, sorry, I found the Image > Draw function... It actually has both outline AND shadow.
I prefer the toolbar method via Edit > Add Text however. The Draw panel is a little clunky.
cday
XnThusiast
Posts: 4185
Joined: Sun Apr 29, 2012 9:45 am
Location: Cheltenham, U.K.

Re: Adding text to JPEG images

Post by cday »

Brother Gabriel-Marie wrote: Wed Aug 16, 2023 4:35 pm Oh, sorry, I found the Image > Draw function... It actually has both outline AND shadow.
I prefer the toolbar method via Edit > Add Text however. The Draw panel is a little clunky.
@user0: :wink:

Yes, if you only need one 'Draw' action.
User avatar
XnTriq
Moderator & Librarian
Posts: 6387
Joined: Sun Sep 25, 2005 3:00 am
Location: Ref Desk

Re: Adding text to JPEG images

Post by XnTriq »

rnmerchant wrote: Tue Aug 15, 2023 10:25 pmBringing up the Text dialogue, it seems to default to MS Shell Dlg 2. This is a font I've never heard of. Is there anything important about this default?
It's a logical font used by default for dialogs and controls (user interface) in Windows.
rnmerchant
Posts: 32
Joined: Wed Nov 04, 2020 2:05 am

Re: Adding text to JPEG images

Post by rnmerchant »

XnTriq wrote: Wed Aug 16, 2023 10:00 pm
rnmerchant wrote: Tue Aug 15, 2023 10:25 pmBringing up the Text dialogue, it seems to default to MS Shell Dlg 2. This is a font I've never heard of. Is there anything important about this default?
It's a logical font used by default for dialogs and controls (user interface) in Windows.
Thanks for this reference. It makes sense. I really should have just searched google rather than bothering busy other people!

Regards Richard :?
rnmerchant
Posts: 32
Joined: Wed Nov 04, 2020 2:05 am

Re: Adding text to JPEG images

Post by rnmerchant »

XnTriq wrote: Wed Aug 16, 2023 3:00 pm
  • BetterJPEG
    “BetterJPEG is a JPEG editor specifically designed to avoid recompression loss when editing and resaving JPEG images. BetterJPEG takes advantage of the fact that JPEG images consist of a number of small independent blocks and does not recompress blocks that don't have to be changed.”
  • RealWorld Photos
    “RealWorld Photos avoids the incremental quality loss caused by repeated .jpg re-saving.
    Unchanged areas of a photograph are not re-compressed during saving. They are taken directly from the original image. The whole process is completely transparent to the end user. It just works! You can even use layers and save the intermediate result in .rli format and still get the benefits of lossless re-saving when producing the final .jpg.”
    • Lossless JPEG Saving
      “A JPEG image is divided into tiles (called MCUs - minimum compression units) and each tile is processed separately. The size of the tiles is 8x8 pixels, but JPEG can save chrominance (hue) information at smaller resolution and therefore a 8x8 pixels of chrominance information can effectively affect for example 16x16 pixels.
      The JPEG codec in RW apps detects which tiles were not changed since the original JPEG image was opened and if such tiles are found, they are copied from the original image without any loss.”
  • XnView Forum
XnTriq - thanks for your detailed and helpful response. This is what makes message boards so great!

I'm not going to worry about it too much but inasmuch as you refer to other programs (which don't) may I draw the inference that XnView actually does 'save as new jpeg' and thus lose a bit of the image quality when adding text? (These are 50-80 year old family photos - a small amount of image loss is not a disaster - but others might have greater concerns that me hence the clarification request...)

Regards Richard
cday
XnThusiast
Posts: 4185
Joined: Sun Apr 29, 2012 9:45 am
Location: Cheltenham, U.K.

Re: Adding text to JPEG images

Post by cday »

rnmerchant wrote: Wed Aug 16, 2023 11:31 pm I'm not going to worry about it too much but inasmuch as you refer to other programs (which don't) may I draw the inference that XnView actually does 'save as new jpeg' and thus lose a bit of the image quality when adding text? (These are 50-80 year old family photos - a small amount of image loss is not a disaster - but others might have greater concerns that me hence the clarification request...)
I would refer you to my original response, that there is no reason for concern in any normal situation... :D

Regarding saving, when an image is edited in any way and then resaved, a new image is necessarily created.

However, if the images you wish to caption were or will be produced by scanning, there may potentially be quality considerations there, related for example to scan resolution and the pixel dimensions of the image files produced, other scanner settings and any subsequent image enhancement.
User avatar
XnTriq
Moderator & Librarian
Posts: 6387
Joined: Sun Sep 25, 2005 3:00 am
Location: Ref Desk

Re: Adding text to JPEG images

Post by XnTriq »

rnmerchant wrote: Wed Aug 16, 2023 11:22 pmI really should have just searched google rather than bothering busy other people!
No worries, Richard! It's a justified question. I didn't know what a "logical font" is, so I learned something (-:
User avatar
XnTriq
Moderator & Librarian
Posts: 6387
Joined: Sun Sep 25, 2005 3:00 am
Location: Ref Desk

Re: Adding text to JPEG images

Post by XnTriq »

rnmerchant wrote: Wed Aug 16, 2023 11:31 pmmay I draw the inference that XnView actually does 'save as new jpeg' and thus lose a bit of the image quality when adding text?
Yes, with the exception of MetadataJPEG lossless transformations, XnView re-compresses/re-encodes newly-created JPEGs. The extent of the so-called generation loss depends on the settings in ToolsSettingsFormatsWriteJPEG.

rnmerchant wrote: Wed Aug 16, 2023 11:31 pmThese are 50-80 year old family photos - a small amount of image loss is not a disaster - but others might have greater concerns that me hence the clarification request...
Are you going to add text in batch or one by one? Can you share a sample?

rnmerchant
Posts: 32
Joined: Wed Nov 04, 2020 2:05 am

Re: Adding text to JPEG images

Post by rnmerchant »

Thanks XnTriq:

Just coming back to this question

Thanks for the clue about the Jpeg write settings! I'd not seen that. I've put the quality to 100% now (it was defaulted to 80%) so I'm happy to know about that option!

Regarding my 'adding text to images' question I had imagined just adding simple descriptors to images one by one. Names, dates, and so on. The idea of adding a slightly larger 'image canvas' has appeal for that little task.

I think that solves my questions! Thanks to everyone.

Richard