Skip to content

Resizetizer takes increasingly longer and longer to process image files when there are lots of images in a folder, such as svg files of flags of the world. #15124

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

Closed
istuart0 opened this issue May 17, 2023 · 5 comments
Labels
area-single-project Splash Screen, Multi-Targeting, MauiFont, MauiImage, MauiAsset, Resizetizer area-tooling XAML & C# Hot Reload, XAML Editor, Live Visual Tree, Live Preview, Debugging s/triaged Issue has been reviewed s/verified Verified / Reproducible Issue ready for Engineering Triage t/bug Something isn't working
Milestone

Comments

@istuart0
Copy link

Description

The build log shows resizetizer taking longer and longer to build the range of png files when you have a lot of files in a folder such as svg files of flags of the world.

Steps to Reproduce

create a file called "Flags" in the "Resources\Images" folder. Copy svg files of flags of the world to at (available from GitHub.

Rebuild project

Link to public reproduction project repository

https://github.com/hampusborgos/country-flags

Version with bug

7.0 (current)

Last version that worked well

Unknown/Other

Affected platforms

I was not able test on other platforms

Affected platform versions

Visual Studio for Mac 17.5.4

Did you find any workaround?

While testing I use a single svg flag file, because processing all 252 files will take many hours!

Relevant log output

Save Image took 14ms (/Users/iStuart/Projects/Maui/xxxxx/xxxxx/obj/Debug/net7.0-android/resizetizer/r/drawable-mdpi/ne.png)
        Save Image took 39ms (/Users/iStuart/Projects/Maui/xxxxx/xxxxx/obj/Debug/net7.0-android/resizetizer/r/drawable-hdpi/ne.png)
        Save Image took 55ms (/Users/iStuart/Projects/Maui/xxxxx/xxxxx/obj/Debug/net7.0-android/resizetizer/r/drawable-xhdpi/ne.png)
        Save Image took 120ms (/Users/iStuart/Projects/Maui/xxxxx/xxxxx/obj/Debug/net7.0-android/resizetizer/r/drawable-xxhdpi/ne.png)
        Save Image took 216ms (/Users/iStuart/Projects/Maui/xxxxx/xxxxx/obj/Debug/net7.0-android/resizetizer/r/drawable-xxxhdpi/ne.png)
        Save Image took 34398ms (/Users/iStuart/Projects/Maui/xxxxx/xxxxx/obj/Debug/net7.0-android/resizetizer/r/drawable-xxxhdpi/cc.png)
        Open SVG took 0ms (/Users/iStuart/Projects/Maui/xxxxx/xxxxx/Resources/Images/Flags/cd.svg)
        Save Image took 16ms (/Users/iStuart/Projects/Maui/xxxxx/xxxxx/obj/Debug/net7.0-android/resizetizer/r/drawable-mdpi/cd.png)
        Save Image took 37ms (/Users/iStuart/Projects/Maui/xxxxx/xxxxx/obj/Debug/net7.0-android/resizetizer/r/drawable-hdpi/cd.png)
        Save Image took 65ms (/Users/iStuart/Projects/Maui/xxxxx/xxxxx/obj/Debug/net7.0-android/resizetizer/r/drawable-xhdpi/cd.png)
        Save Image took 152ms (/Users/iStuart/Projects/Maui/xxxxx/xxxxx/obj/Debug/net7.0-android/resizetizer/r/drawable-xxhdpi/cd.png)
        Save Image took 276ms (/Users/iStuart/Projects/Maui/xxxxx/xxxxx/obj/Debug/net7.0-android/resizetizer/r/drawable-xxxhdpi/cd.png)
        Open SVG took 0ms (/Users/iStuart/Projects/Maui/xxxxx/xxxxx/Resources/Images/Flags/cf.svg)
        Save Image took 0ms (/Users/iStuart/Projects/Maui/xxxxx/xxxxx/obj/Debug/net7.0-android/resizetizer/r/drawable-mdpi/cf.png)
        Save Image took 0ms (/Users/iStuart/Projects/Maui/xxxxx/xxxxx/obj/Debug/net7.0-android/resizetizer/r/drawable-hdpi/cf.png)
        Save Image took 0ms (/Users/iStuart/Projects/Maui/xxxxx/xxxxx/obj/Debug/net7.0-android/resizetizer/r/drawable-xhdpi/cf.png)
        Save Image took 0ms (/Users/iStuart/Projects/Maui/xxxxx/xxxxx/obj/Debug/net7.0-android/resizetizer/r/drawable-xxhdpi/cf.png)
        Save Image took 0ms (/Users/iStuart/Projects/Maui/xxxxx/xxxxx/obj/Debug/net7.0-android/resizetizer/r/drawable-xxxhdpi/cf.png)
        Open SVG took 0ms (/Users/iStuart/Projects/Maui/xxxxx/xxxxx/Resources/Images/Flags/cg.svg)
        Save Image took 0ms (/Users/iStuart/Projects/Maui/xxxxx/xxxxx/obj/Debug/net7.0-android/resizetizer/r/drawable-mdpi/cg.png)
        Save Image took 0ms (/Users/iStuart/Projects/Maui/xxxxx/xxxxx/obj/Debug/net7.0-android/resizetizer/r/drawable-hdpi/cg.png)
        Save Image took 0ms (/Users/iStuart/Projects/Maui/xxxxx/xxxxx/obj/Debug/net7.0-android/resizetizer/r/drawable-xhdpi/cg.png)
        Save Image took 0ms (/Users/iStuart/Projects/Maui/xxxxx/xxxxx/obj/Debug/net7.0-android/resizetizer/r/drawable-xxhdpi/cg.png)
        Save Image took 0ms (/Users/iStuart/Projects/Maui/xxxxx/xxxxx/obj/Debug/net7.0-android/resizetizer/r/drawable-xxxhdpi/cg.png)
        Save Image took 71439ms (/Users/iStuart/Projects/Maui/xxxxx/xxxxx/obj/Debug/net7.0-android/resizetizer/r/drawable-xhdpi/bb.png)
        Save Image took 124399ms (/Users/iStuart/Projects/Maui/xxxxx/xxxxx/obj/Debug/net7.0-android/resizetizer/r/drawable-xxhdpi/bb.png)

... and ...

        Open SVG took 0ms (/Users/iStuart/Projects/Maui/xxxxx/xxxxx/Resources/Images/Flags/cg.svg)
        Save Image took 0ms (/Users/iStuart/Projects/Maui/xxxxx/xxxxx/obj/Debug/net7.0-android/resizetizer/r/drawable-mdpi/cg.png)
        Save Image took 0ms (/Users/iStuart/Projects/Maui/xxxxx/xxxxx/obj/Debug/net7.0-android/resizetizer/r/drawable-hdpi/cg.png)
        Save Image took 0ms (/Users/iStuart/Projects/Maui/xxxxx/xxxxx/obj/Debug/net7.0-android/resizetizer/r/drawable-xhdpi/cg.png)
        Save Image took 0ms (/Users/iStuart/Projects/Maui/xxxxx/xxxxx/obj/Debug/net7.0-android/resizetizer/r/drawable-xxhdpi/cg.png)
        Save Image took 0ms (/Users/iStuart/Projects/Maui/xxxxx/xxxxx/obj/Debug/net7.0-android/resizetizer/r/drawable-xxxhdpi/cg.png)
        Save Image took 71439ms (/Users/iStuart/Projects/Maui/xxxxx/xxxxx/obj/Debug/net7.0-android/resizetizer/r/drawable-xhdpi/bb.png)
        Save Image took 124399ms (/Users/iStuart/Projects/Maui/xxxxx/xxxxx/obj/Debug/net7.0-android/resizetizer/r/drawable-xxhdpi/bb.png)
        Save Image took 201722ms (/Users/iStuart/Projects/Maui/xxxxx/xxxxx/obj/Debug/net7.0-android/resizetizer/r/drawable-xxxhdpi/bb.png)
@istuart0 istuart0 added the t/bug Something isn't working label May 17, 2023
@Eilon Eilon added the area-single-project Splash Screen, Multi-Targeting, MauiFont, MauiImage, MauiAsset, Resizetizer label May 17, 2023
@PureWeen PureWeen added the area-tooling XAML & C# Hot Reload, XAML Editor, Live Visual Tree, Live Preview, Debugging label May 17, 2023
@PureWeen PureWeen added this to the Backlog milestone May 17, 2023
@ghost
Copy link

ghost commented May 17, 2023

We've added this issue to our backlog, and we will work to address it as time and resources allow. If you have any additional information or questions about this issue, please leave a comment. For additional info about issue management, please read our Triage Process.

@PureWeen
Copy link
Member

@mattleibow

@istuart0
Copy link
Author

istuart0 commented May 18, 2023

I think I've found the problem. If we look at the code behind one of the flags that takes a very long time, we see this:

<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 24000 16000">
<title>Flag of Barbados</title>
<rect width="24000" height="16000" fill="#00267f"/>
<rect width="8000" height="16000" fill="#ffc726" x="8000"/>
<path id="h" fill="#000" d="M 12000,4124 C 11740,4833 11475,5571 10908,6136 C 11084,6078 11392,6026 11590,6031 L 11590,9013 L 10748,9138 C 10718,9135 10708,9088 10708,9024 C 10627,8098 10408,7320 10156,6515 C 10138,6405 9819,5985 10065,6059 C 10095,6063 10424,6197 10372,6133 C 9924,5669 9269,5335 8633,5236 C 8577,5222 8544,5250 8594,5315 C 9438,6614 10144,8147 10138,9966 C 10466,9966 11261,9772 11590,9772 C 11590,9772 11590,11876 11590,11876 L 12005,11876 12100, 6000 z"/>
<use xlink:href="#h" transform="translate(24000,0) scale(-1,1)"/>
</svg>

The sizes are ridiculously large. Going through each one manually, or with Python, I suppose the solution is going to be check the dimensions of each svg before adding it to the project.

@Zhanglirong-Winnie Zhanglirong-Winnie added s/verified Verified / Reproducible Issue ready for Engineering Triage s/triaged Issue has been reviewed labels Jan 22, 2024
@Zhanglirong-Winnie
Copy link

Verified this issue with VSM 17.6.7 (build 400). Can repro this issue with sample project.

@mattleibow
Copy link
Member

This seems to be an issue with the SVG. You can either resize as you mention - or use the BaseSize to set the size to a more desirable on. You could use it to make all the flags the same size.

@mattleibow mattleibow closed this as not planned Won't fix, can't repro, duplicate, stale May 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-single-project Splash Screen, Multi-Targeting, MauiFont, MauiImage, MauiAsset, Resizetizer area-tooling XAML & C# Hot Reload, XAML Editor, Live Visual Tree, Live Preview, Debugging s/triaged Issue has been reviewed s/verified Verified / Reproducible Issue ready for Engineering Triage t/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants