Skip to content

Thumbnail API should keep file type #12008

Closed

Description

@tobiasKaminsky

The Thumbnail API, e.g. /index.php/apps/files/api/v1/thumbnail/253/253/Shared/temp.jpg should obey the file type and return the same filetype as thumbnail:
jpg -> jpg
png -> png

old version:

Hello,

I have developed the thumbnail generation on android app and we use the new route
/index.php/apps/files/api/v1/thumbnail/253/253/Shared/temp.jpg

Opening this url in the browser lets me download a png file.

If you have a small jpg file: 587x720 with 77,2 kb and get a thumbnail of it I get a png file with:
253x253 with 113,7kB.
So it is bigger than the original file.
I suggest to use jpg with compression to get a smaller file size:
Originial: 77,2kb
PNG: 113,7kb
jpg of png: 19,5kb
compressed at 80% jpg of png: 16,1kb.

For me there is no visible difference between them, but we would save a lot of traffic.

Activity

  1. LukasReschke commented on Nov 6, 2014

    @LukasReschke
    Contributor

    @georgehrke Would it make sense to use JPG per default for our previews?

  2. georgehrke commented on Nov 6, 2014

    @georgehrke
    Contributor

    I'd personally prefer to stay with png as it's lossless. JPG is good for photographies but pretty bad for everything else. PNG can handle both fine, the only downside is that the files might be bigger.

  3. tobiasKaminsky commented on Nov 6, 2014

    @tobiasKaminsky
    ContributorAuthor

    @georgehrke As it is only for thumbnails and they are transferred over the internet I think it is more important to have a smaller file size.
    I know that JPG is not so good for text images, but I guess the most images are photographies.

  4. tobiasKaminsky commented on Nov 7, 2014

    @tobiasKaminsky
    ContributorAuthor

    @georgehrke Another idea I had: Why not use the same filetype for thumbnails as the original file is? jpg would be jpg thumbnails and png -> png.
    With this it would be up to the user what filetype they use.

  5. georgehrke commented on Nov 8, 2014

    @georgehrke
    Contributor

    @tobiasKaminsky The api should always return the same file format and not randomly change between png and jpg

  6. tobiasKaminsky commented on Nov 8, 2014

    @tobiasKaminsky
    ContributorAuthor

    @georgehrke what do you mean with ranomly? Currently all thumbnails are png.
    But, as I suggested before, I agree with your latest idea.

  7. georgehrke commented on Nov 8, 2014

    @georgehrke
    Contributor

    @tobiasKaminsky With randomly I mean that the client which uses api would have to check the mime type (is it jpg or something else) and then expect different image types of the preview. It should always return the same format.

  8. changed the title [-]Preview uses PNG[/-] [+]Thumbnail API should keep file type[/+] on Nov 9, 2014
  9. tobiasKaminsky commented on Nov 9, 2014

    @tobiasKaminsky
    ContributorAuthor

    @georgehrke
    Ok. I have changed the title and the description of this issue.

  10. oparoz commented on Nov 21, 2014

    @oparoz
    Contributor

    Maybe make it an option via the URL, so that apps can have a setting which trades bandwidth for quality?

  11. tobiasKaminsky commented on Jan 10, 2015

    @tobiasKaminsky
    ContributorAuthor

    Is there an update?
    As we are getting closer to OC8, and this is the first version that supports thumbnail download for android app, it would be great to have this included, as otherwise we are wasting a lot of bandwidth.
    Unfortunately I cannot do this by myself :/

  12. tobiasKaminsky commented on Apr 16, 2015

    @tobiasKaminsky
    ContributorAuthor

    bump
    I am currently developing a feature that loads reduced versions of images to a cache.
    With this the bandwith is reduced dramatically on the android app.
    But for this it is necessary to have a jpg reduced version of an original jpg file as otherwise the file size is too high and the benefit is far less or even not existent.

  13. oparoz commented on Jun 6, 2015

    @oparoz
    Contributor

    I propose to do this:

    • jpg, raw, tiff -> jpg
    • everything else -> png

    It's not perfect, but would be an acceptable solution.

  14. tobiasKaminsky commented on Jun 8, 2015

    @tobiasKaminsky
    ContributorAuthor

    I am fine with this. As long as the preview size is not bigger than the original file :)

  15. tobiasKaminsky commented on Sep 17, 2015

    @tobiasKaminsky
    ContributorAuthor

    Any update on this?
    It is not good to have the previews on our owncloud app with these large PNGs...

  16. tobiasKaminsky commented on Sep 30, 2015

    @tobiasKaminsky
    ContributorAuthor

    @oparoz Can you help me with this? Or can you give me a hint, where to adjust this myself?
    As the related PR will be merged in nearer future we need this.

    Thank you!

  17. oparoz commented on Oct 1, 2015

    @oparoz
    Contributor

    Fun fact, on 8.1+, you're already getting a JPG :D, it just has the wrong extension.
    I don't think lowering the quality is a good idea.
    4156x3118 JPG | 5.05MB
    2048x1536 max preview | 753KB

  18. oparoz commented on Nov 5, 2015

    @oparoz
    Contributor

    Since the file is of the correct type, should we close this or is the extension important?

  19. tobiasKaminsky commented on Nov 5, 2015

    @tobiasKaminsky
    ContributorAuthor

    There are a few operation systems that rely on the correct extensions, so there should e the correct extension I guess.

  20. added this to the backlog milestone on Mar 1, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions