Chronostasys / Blazor.Cropper

A blazor library provides component to crop image
MIT License
84 stars 19 forks source link

Why require InputFile? #47

Closed milambert6178 closed 2 years ago

milambert6178 commented 2 years ago

Like the control, but could you update (or workaround) the requirement to have and InputFile control and use a base64/filestream as the datasource?

Chronostasys commented 2 years ago

Like the control, but could you update (or workaround) the requirement to have and InputFile control and use a base64/filestream as the datasource?

Duplicate #46 .
Blazor.Cropper supports load data from base64 or stream. You can find a simple guide in #46 . I'll add tutorial to docs and samples ASAIC.

Chronostasys commented 2 years ago

Docs and sample updated

milambert6178 commented 2 years ago

Thanks, working great. Though the cropped image in almost 4x-6x the file size of the original iBrowserfile. I set the ImageFile with Ibrowserfile of say 67k (small doc pics), but after I save using GetDataAsync() it's size balloons to ~500-600k. I would think the cropped image should be even smaller. Though, I don't really know much about image processing. Any suggestion, resized options? I use iBrowserFile RequestImageFileAsync() when I use InputFile control and that works great, but even when I use the resized file in Cropper the resulting image is 4-6x larger than the original.

Chronostasys commented 2 years ago

Thanks, working great. Though the cropped image in almost 4x-6x the file size of the original iBrowserfile. I set the ImageFile with Ibrowserfile of say 67k (small doc pics), but after I save using GetDataAsync() it's size balloons to ~500-600k. I would think the cropped image should be even smaller. Though, I don't really know much about image processing. Any suggestion, resized options? I use iBrowserFile RequestImageFileAsync() when I use InputFile control and that works great, but even when I use the resized file in Cropper the resulting image is 4-6x larger than the original.

Yes, you are right. That's probably because I converted the cropped images to full quality pngs. Thanks for sharing, I'll try to fix it recently.

Chronostasys commented 2 years ago

Thanks, working great. Though the cropped image in almost 4x-6x the file size of the original iBrowserfile. I set the ImageFile with Ibrowserfile of say 67k (small doc pics), but after I save using GetDataAsync() it's size balloons to ~500-600k. I would think the cropped image should be even smaller. Though, I don't really know much about image processing. Any suggestion, resized options? I use iBrowserFile RequestImageFileAsync() when I use InputFile control and that works great, but even when I use the resized file in Cropper the resulting image is 4-6x larger than the original.

Yes, you are right. That's probably because I converted the cropped images to full quality pngs. Thanks for sharing, I'll try to fix it recently.

I'll open a new issue for it

Chronostasys commented 2 years ago

Thanks, working great. Though the cropped image in almost 4x-6x the file size of the original iBrowserfile. I set the ImageFile with Ibrowserfile of say 67k (small doc pics), but after I save using GetDataAsync() it's size balloons to ~500-600k. I would think the cropped image should be even smaller. Though, I don't really know much about image processing. Any suggestion, resized options? I use iBrowserFile RequestImageFileAsync() when I use InputFile control and that works great, but even when I use the resized file in Cropper the resulting image is 4-6x larger than the original.

@milambert6178 I add a Quality parameter in version 1.2.8 which can used to decrease out the size of jpg and webp image. And the cropper's output format will follow the input img's by default, which should significantly decrease the output image 'ssize when cropping jpg comparing to the former version

milambert6178 commented 2 years ago

Thanks for the quick fix, though when I try to update through NuGet Package Manager I now lose the Blazor.Cropper reference. Get a Namespace not found at Using Blazor.Cropper. Have this in my csproj file: PackageReference Include= "Chronos.Blazor.Cropper" Version="1.2.8"

Mike

Chronostasys commented 2 years ago

Thanks for the quick fix, though when I try to update through NuGet Package Manager I now lose the Blazor.Cropper reference. Get a Namespace not found at Using Blazor.Cropper. Have this in my csproj file: PackageReference Include= "Chronos.Blazor.Cropper" Version="1.2.8"

Mike

Have you tried dotnet restore? If it doesn't work, please post the error message.

milambert6178 commented 2 years ago

no change with restore.. I don't really get an error, just can't find the Blazor.Cropped Namespace. If I go back to 1.2.7, it works but when I update to 1.2.8 it breaks. Weird... image Here is my csproj image

Chronostasys commented 2 years ago

no change with restore.. I don't really get an error, just can't find the Blazor.Cropped Namespace. If I go back to 1.2.7, it works but when I update to 1.2.8 it breaks. Weird... image Here is my csproj image

@milambert6178 Thanks for the info. I think I found the problem: I added dotnet 6 to the target frameworks, but didn't update the dependencies. I fixed it in v 1.2.9, you may need to wait a few minutes before this version available.

milambert6178 commented 2 years ago

no change with restore.. I don't really get an error, just can't find the Blazor.Cropped Namespace. If I go back to 1.2.7, it works but when I update to 1.2.8 it breaks. Weird... image Here is my csproj image

@milambert6178 Thanks for the info. I think I found the problem: I added dotnet 6 to the target frameworks, but didn't update the dependencies. I fixed it in v 1.2.9, you may need to wait a few minutes before this version available.

Nope, same issue. It works fine when I go back to 1.2.7.

Chronostasys commented 2 years ago

no change with restore.. I don't really get an error, just can't find the Blazor.Cropped Namespace. If I go back to 1.2.7, it works but when I update to 1.2.8 it breaks. Weird... image Here is my csproj image

@milambert6178 Thanks for the info. I think I found the problem: I added dotnet 6 to the target frameworks, but didn't update the dependencies. I fixed it in v 1.2.9, you may need to wait a few minutes before this version available.

Nope, same issue. It works fine when I go back to 1.2.7.

Could you try to restart the ide? The issue disappeared on my computer after update to v 1.2.9.

image
milambert6178 commented 2 years ago

no change with restore.. I don't really get an error, just can't find the Blazor.Cropped Namespace. If I go back to 1.2.7, it works but when I update to 1.2.8 it breaks. Weird... image Here is my csproj image

@milambert6178 Thanks for the info. I think I found the problem: I added dotnet 6 to the target frameworks, but didn't update the dependencies. I fixed it in v 1.2.9, you may need to wait a few minutes before this version available.

Nope, same issue. It works fine when I go back to 1.2.7.

Could you try to restart the ide? The issue disappeared on my computer after update to v 1.2.9. image

Nope, same issue. I even tried it on a completely different project and got the same result...

Chronostasys commented 2 years ago

@milambert6178 Could you upload a simple git project?

Chronostasys commented 2 years ago

Alright, I'm facing the same issue after I manually remove the nuget cache. I'll dig deeper into it

milambert6178 commented 2 years ago

Alright, I'm facing the same issue after I manually remove the nuget cache. I'll dig deeper into it

Ok, I just created a brand new project and got the same error too. I'll wait to here back. Thanks Again!

Chronostasys commented 2 years ago

Alright, I'm facing the same issue after I manually remove the nuget cache. I'll dig deeper into it

Ok, I just created a brand new project and got the same error too. I'll wait to here back. Thanks Again!

Thanks so much for your efforts. Please try v 1.2.10, it's likely a cd related issue.

milambert6178 commented 2 years ago

Yeah! No more error!! Thanks. So how does the Quality setting work? Is it like 1-100, with 100 being original?

Chronostasys commented 2 years ago

Yeah! No more error!! Thanks. So how does the Quality setting work? Is it like 1-100, with 100 being original?

Yep, remember it only works for jpg and webp format.

milambert6178 commented 2 years ago

So the file size really doesn't change no matter what I set the Quality param to. The original is only 67K, but after I crop it, it jumps to over 400K no matter if I set the Quality param to 1 or 100. I'm using a very stripped-down declaration of Copper, should there be more I should be declaring? image

milambert6178 commented 2 years ago

So the file size really doesn't change no matter what I set the Quality param to. The original is only 67K, but after I crop it, it jumps to over 400K no matter if I set the Quality param to 1 or 100. I'm using a very stripped-down declaration of Copper, should there be more I should be declaring? image

Ignore that, I must have done something wrong, after playing with it a bit more, things are working perfectly! Thanks for all your help and quick response!! Appreciate it..