News:

SMF 2.1.4 has been released! Take it for a spin! Read more.

Main Menu

(free/paid) Image Processing on Upload

Started by fortser, May 06, 2025, 01:43:50 PM

Previous topic - Next topic

fortser

i have an image-processing forum, so many heavy PNG images are being uploaded. I need a script that, at upload time, converts the images to JPEG at 80% quality, while also extracting technical data from the PNG file (similar to EXIF data, but in a slightly different, custom format), and publishes that data in the body of the post alongside the uploaded image.

I've already written a Python script on my local machine that converts the image to the format I need and saves the extracted text data to a .txt file next to the JPEG.

Please advise on the safest way, given the forum's architecture, to hook my script into the existing image-upload process. :-X

Kindred

moved to mod requests

Please update the title to include whether this is a free or paid request
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

fortser

I don't see a button for editing messages (((
if it's really difficult to implement such functionality, then of course I'm ready for a small payment. We'll make an agreement

GL700Wing

@forster There is already a mod which I manage that converts/resizes images on upload (see  Automatic Attachment Rotation (and Resize)) but it doesn't extract any image data.

What image data do you want to extract and where/how do you want to use the data?
Life doesn't have to be perfect to be wonderful ...

Slava
Ukraini!
"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum. Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

dodos26

You cannot view this attachment.
You cannot view this attachment.
You cannot view this attachment.

Want to get something like this inside the forum?

fortser

Here are examples of images (generated in the stable diffusion system) and the technical parameters of the generation. These parameters are located inside the technical data in the PNG file.

1
a detailed photo of  A close-up of a couple's faces inches apart, lips parted, hot breath mingling, eyes half-closed in pleasure, her hand gripping his jaw, intense passion, soft shadows, cinematic focus.

Steps: 25,  Euler, Schedule type: Simple, CFG scale: 1, Distilled CFG Scale: 3.5, Seed: 1735199045, Size: 896x1152, Model hash: 129032f322, Model: nsfwMASTERFLUXFp16LoraMerged_v12Q80Gguf, Version: f2.0.1v1.10.1-previous-659-gc055f2d4, Module 1: clip_l, Module 2: t5xxl_fp8_e4m3fn, Module 3: ae

2
Elderly bearded man with weathered face, deep wrinkles, kind eyes, wearing simple linen clothes, sitting by a wooden table in a rustic interior

(deformed face:1.3), (asymmetrical face:1.2), (disfigured:1.3), poorly drawn face, (bad anatomy:1.2), (extra limbs:1.3), missing fingers, (mutated hands:1.3), blurry, low resolution, pixelated, noisy, jpeg artifacts, (text:1.2), watermark, logo, signature, (cartoon style:1.3), (anime:1.3), 3d, illustration, sketch, painting, (low quality:1.3), (bad quality:1.3), distortion, wrong proportions, (multiple faces:1.3), cropped

Steps: 28,  Euler a, Schedule type: Automatic, CFG scale: 7, Seed: 111910324, Size: 1024x1024, Model hash: aeb7e9e689, Model: juggernautXL_v8Rundiffusion, Version: 1.10.1

fortser

GL700Wing, Yes, I was thinking about this extension. It would be great if it could be adapted to my needs.
dodos26, yes, it seems that your option does what it needs to do. can this script be used while uploading images to regular messages ?

vbgamer45

Interesting never knew PNG had data like EXIF inside them.
Community Suite for SMF - Grow your forum with SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com - Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

dodos26

It depends on what you want to achieve, do you want to create some database, do you have some gallery or only from attachments? Do you want to only read data after clicking a button? If you only want after clicking a button, you can do it easily, through javascript and fetch.

Before testing use check_config.php next try api_docs.php next can test this script via index.html

For ur photos return:
IHDR:
width: 896
height: 1152
depth: 8
color: 6
compression: 0
filter: 0
interlace: 0
iTXt:
parameters: [International Text]
other:
IDAT: 691
IEND: 0

And:
IHDR:
width: 1024
height: 1024
depth: 8
color: 2
compression: 0
filter: 0
interlace: 0
tEXt:
parameters: Elderly bearded man with weathered face, deep wrinkles, kind eyes, wearing simple linen clothes, sitting by a wooden table in a rustic interior Negative prompt: (deformed face:1.3), (asymmetrical face:1.2), (disfigured:1.3), poorly drawn face, (bad anatomy:1.2), (extra limbs:1.3), missing fingers, (mutated hands:1.3), blurry, low resolution, pixelated, noisy, jpeg artifacts, (text:1.2), watermark, logo, signature, (cartoon style:1.3), (anime:1.3), 3d, illustration, sketch, painting, (low quality:1.3), (bad quality:1.3), distortion, wrong proportions, (multiple faces:1.3), cropped Steps: 28, Sampler: Euler a, Schedule type: Automatic, CFG scale: 7, Seed: 111910324, Size: 1024x1024, Model hash: aeb7e9e689, Model: juggernautXL_v8Rundiffusion, Version: 1.10.1
other:
IDAT: 17853
IEND: 0

Advertisement: