Generate arbitrary shape PRNU shown as such #27

Open
opened 2024-03-28 21:59:25 +01:00 by Benjamin_Loison · 4 comments

Would enable easy comprehension if adding images thanks to splitting helps.

See #21 and #24.

Would enable easy comprehension if adding images thanks to splitting helps. See #21 and #24.
Benjamin_Loison added the
enhancement
high priority
quick
labels 2024-03-29 12:21:19 +01:00
Author
Owner
import os
from PIL import Image, ImageFont, ImageDraw

# Supports `WIDTH` > `HEIGHT` and conversely.
WIDTH = 1_000
HEIGHT = 1_000
TEXT = 'PRNU'

img = Image.new('L', (WIDTH, HEIGHT))
draw = ImageDraw.Draw(img)
# I guess that the maximal character height is higher than the maximal character width. Hence, the `TEXT` may not be spanned on the full width.
fontSize = min(HEIGHT, WIDTH // len(TEXT))
font = ImageFont.truetype(os.path.expanduser('~/.local/share/fonts/impact.ttf'), fontSize)
# Center vertically, especially in the case `HEIGHT` > `WIDTH`.
draw.text((0, HEIGHT // 2 - fontSize // 2), TEXT, 255, font = font)

img.show()

I do not know if I have done anything on Linux Mint to have this font at this location.

find /usr/share/fonts/ -iname '*impact*'

does not return any result on my Linux Mint.

```py import os from PIL import Image, ImageFont, ImageDraw # Supports `WIDTH` > `HEIGHT` and conversely. WIDTH = 1_000 HEIGHT = 1_000 TEXT = 'PRNU' img = Image.new('L', (WIDTH, HEIGHT)) draw = ImageDraw.Draw(img) # I guess that the maximal character height is higher than the maximal character width. Hence, the `TEXT` may not be spanned on the full width. fontSize = min(HEIGHT, WIDTH // len(TEXT)) font = ImageFont.truetype(os.path.expanduser('~/.local/share/fonts/impact.ttf'), fontSize) # Center vertically, especially in the case `HEIGHT` > `WIDTH`. draw.text((0, HEIGHT // 2 - fontSize // 2), TEXT, 255, font = font) img.show() ``` I do not know if I have done anything on Linux Mint to have this font at this location. ```bash find /usr/share/fonts/ -iname '*impact*' ``` does not return any result on my Linux Mint.
Author
Owner

Should also be able to Gaussian noise the generated text.

Should also be able to Gaussian noise the generated text.
Author
Owner
https://stackoverflow.com/a/16377244 https://stackoverflow.com/a/4902713
Author
Owner
2d96bdc225092efb6cc09479cb8696c931f7a522
Sign in to join this conversation.
No description provided.