- Home /
Editor script to generate .PNGs from other .PNGs
I have two folders in my Assets folder. One containing the source images and another that will contain the generated images. I'm currently trying to use System.Drawing and Bitmaps to do the image manipulation but I'm running into an error:
ArgumentException: A null reference or invalid value was found [GDI+ status: InvalidParameter]
It's working fine when I don't run the script as an editor script in Unity.
Any alternatives to editing .PNGs in Unity editor scripts?
Answer by kaarloew · Aug 20, 2019 at 10:34 AM
You can load .PNG files as Texture2D in Unity, do manipulations and write the output to a folder https://docs.unity3d.com/ScriptReference/Texture2D-ctor.html https://docs.unity3d.com/ScriptReference/ImageConversion.LoadImage.html https://docs.unity3d.com/ScriptReference/ImageConversion.EncodeToPNG.html
Your answer
![](https://koobas.hobune.stream/wayback/20220612210908im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Bitmap images quality 2 Answers
Can you set Read/Write on an image in an Editor Script? 1 Answer
Bitmaps in unity 4 Answers
How do I resize the Lightmap Array via Editor Script? 1 Answer