Best way to create Thumbnails of images

ThomasBurkhartThomasBurkhart DEMember ✭✭✭✭

Hi,

I need the function in my app, that the user can pick an image from the image gallery and a Thumbnail of this Image should the be stored in a Zip-File.
I have no problem accesing a stream of the just picked image through the MediaPlugin and I can write into a ZIP-File via a Stream.

What's the easiest way to get a Thumbnail image from the selected image?

All the best

Thomas

Tagged:

Best Answers

  • GeraldVersluisGeraldVersluis NLUniversity ✭✭✭✭
    Accepted Answer

    @ThomasBurkhart said:
    One question. Instead of using compiler switches, would it also be possible to create a partial class with one part of the class in the platform specific projects?

    It would probably be better to use Dependency Injection for this. I've explained the basics in a blog post here.

Answers

  • ThomasBurkhartThomasBurkhart DEMember ✭✭✭✭

    Has nobody an idea?

  • ThomasBurkhartThomasBurkhart DEMember ✭✭✭✭

    Thanks a lot, that looks excatly like the function I was looking for!!!

  • ThomasBurkhartThomasBurkhart DEMember ✭✭✭✭

    One question. Instead of using compiler switches, would it also be possible to create a partial class with one part of the class in the platform specific projects?

  • GeraldVersluisGeraldVersluis NLUniversity ✭✭✭✭
    Accepted Answer

    @ThomasBurkhart said:
    One question. Instead of using compiler switches, would it also be possible to create a partial class with one part of the class in the platform specific projects?

    It would probably be better to use Dependency Injection for this. I've explained the basics in a blog post here.

  • ThomasBurkhartThomasBurkhart DEMember ✭✭✭✭

    I'm just trying to add this class to my project, but the compiler complains that he doesn't know the type Bitmap.

    Which usings have I to use to get these Android specifics?

  • ThomasBurkhartThomasBurkhart DEMember ✭✭✭✭

    @DanielL
    The class above scales the image but be keeping its aspect ratio which is fine. The problem ist you want to have the tumbnails of e.g. ListView to be all the same size, so it would be needed to crop the image after scaling if necessary.
    Any idea how I could change the above class to achive this?

  • MCvelMCvel USMember ✭✭

    Hi mates,

    I think I'm having now the same questions you had @ThomasBurkhart
    to keep the same aspect ratio for all thumbnails, or to handle that in the image gallery with a fixed size,
    also if one of you have knows what would be the best, to store the thumbnail in a separated folder or in the image itself using Exif ?

    thank you!

  • AlejandroSeguraAlejandroSegura USMember ✭✭

    @ThomasBurkhart said:
    I'm just trying to add this class to my project, but the compiler complains that he doesn't know the type Bitmap.

    Which usings have I to use to get these Android specifics?

    In case anybody else needs this I believe all you have to do is inside the Android method give it the namespace.

    So instead of:
    Bitmap originalImage = BitmapFactory.DecodeFile(imageData);

    You do:
    Android.Graphics.Bitmap originalImage = Android.Graphics.BitmapFactory.DecodeFile(imageData);

  • SaurabhRathiSaurabhRathi USMember

    @DanielL, Not able to access "PictureDecoder" in winphone 8.1.
    Can you please provide the Resize the image for winphone 8.1, I think your code is just compatible with winphone 8.

  • SaurabhRathiSaurabhRathi USMember

    @DanielL, Not able to access "PictureDecoder" in winphone 8.1.
    Can you please provide the Resize the image for winphone 8.1, I think your code is just compatible with winphone 8.

Sign In or Register to comment.