Skip to content

audioscavenger/JPMark

Repository files navigation

JPMark

JPMark is a LOSSLESS JPEG watermarking tool. JPMark

Presentation

How does it work?

Imagick extracts a chunk and watermarks it, then jpegtran drops it back at the same spot without the whole jpeg being recompressed at all.

The chunk size and position matches exaclty the nearest DCT block, based off the actual sampling factor of the picture. A 8x8 modulo is applied to make sure we match the nearest block.

The chunk containing the watermark is recompressed with the exact same quality settings and sampling factor as the original picture.

The watermark will be centered by default, near the bottom of your pictures. Actual position and size is customizable, and should depend on the font you use. Some trial and error will be needed to make sure the chunk covers the watermark exactly.

Because the whole picture is NOT recompressed, it is blazing fast and you keep the original JPEG quality!

Bonus: Also adds Exif/XMP/IPTC Copyright tags with exiv2.

Wait, what? LOSSLESS?

Recompression of the watermark chunk is indeed lossy, but it's not humanely visible.

Then it's not 100% lossless, isn't that clickbait?

Haha, everyone knows that JPEG is lossy.

How to use this batch?

  • test it by dropping a jpeg over it a see the magic
  • you can also drop a folder over it
  • the best way: place a shortcut to it in your sendTo folder!

Requisites:

  • jpegtran: Jpeg lossless operations
  • iMagick: Portable Win64 static at 16 bits-per-pixel component.
  • exiftool: ExifTool by Phil Harvey

How to get it to work?

  • clone this project in some random place
  • download all requisites to wherever you want
  • update the custom part inside
  • make sure you enter the paths to all requisites in the batch properly
  • Exif tags: update the custom copyright.example.txt or disable Exif tags with AddExifTags=false
  • test by dragging a sample jpeg over it
  • try a different font.ttf!

TODO:

  • BUG: wwidthPct and wheightPct transposed still don't work for squares
  • wwidthPct and wheightPct transposed for portrait
  • Offer an easy way to guess an ideal chink size for picture ratios different then 3:2
  • Offer an easy way to place the watermark where you want it
  • BUG: does not work for portrait
  • BUG: does not work for pictures smaler then 2048
  • add option to overwrite original files
  • download all requisites automatically with powershell
  • find a way to shift from bottom that's not a fixed amount of pixels
  • use Exif template for copyright: https://blog.laurencebichon.com/en/metadata-copyright-example-for-a-freelance-photographer/
  • add more examples for Exif/XMP?IPTC tags
  • include a list of all fonts available with imagick and in local folder or Windows fonts
  • add prechecks for all required binaries
  • load all custom values from a separate file/script
  • make an app with an installer
  • make money

revisions:

  • 1.5.0 chunk size transpose now take care of any odd ratios! We simply base the chink size off a 3:2 ratio by calculating a fake width/height only for the chunk
  • 1.4.4 chunk size transpose bugfix for portrait
  • 1.4.3 added option to overwrite existing watermarked pictures
  • 1.4.2 wwidthPct and wheightPct transposed for portrait
  • 1.4.1 bottomDistance is now a percentage and works for any size pictures
  • 1.4.0 create and stack chunks with different values of alpha/color with a number on top and let user choose the best one
  • 1.3.2 prompt for additional tags and alpha
  • 1.3.1 prompt for different tagFiles
  • 1.3.0 batch processing
  • 1.2.0 exiv2/IPTC/XMP tags and copyright based off a text file
  • 1.1.0 working release

🍺 Buy me a beer

Like my work? This tool helped you? Want to sponsor more awesomeness like this?

About

JPMark is a LOSSLESS JPEG watermarking tool.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published