Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Assuming jpeg when it's not certain #5

Open
marcelklehr opened this issue Oct 26, 2023 · 4 comments
Open

Assuming jpeg when it's not certain #5

marcelklehr opened this issue Oct 26, 2023 · 4 comments
Assignees

Comments

@marcelklehr
Copy link
Member

https://github.com/nextcloud/text2image_helper/blob/main/lib/Service/Text2ImageHelperService.php#L234

text2image_stablediffusion for example returns png images. You can detect the mimetype from the content using a php function I forgot the name of :D

@marcelklehr
Copy link
Member Author

Ah, I see you're converting to jpeg here https://github.com/nextcloud/text2image_helper/blob/main/lib/Service/Text2ImageHelperService.php#L128-L133

mmh. I'd rather we keep the original format and stay agnostic

@MB-Finski
Copy link
Contributor

Depends highly on the provider. OpenAI provides PNGs that are 5mb per pop. The idea here was to guarantee consistent compression and file size.

@marcelklehr
Copy link
Member Author

Alternatively, you can also use the preview manager to create smaller previews: https://nextcloud-server.netlify.app/classes/ocp-ipreview#method_getPreview

@MB-Finski
Copy link
Contributor

With OpenAI, for example, it's not about resolution (max 1024x1024) but rather just the compression. I get that I can also use the preview manager for the compression. But given that image compression is relatively inexpensive (especially since it's done only once per file and not for every request here) I'd tend to think using the php built-in methods makes sense here. Would you agree?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants