Jump to content
  • 0

how to convert image by script runner in act editor?


dreamsambit

Question


  • Group:  Members
  • Topic Count:  3
  • Topics Per Day:  0.00
  • Content Count:  5
  • Reputation:   0
  • Joined:  07/28/15
  • Last Seen:  

I use this script

            Layer layer = act[selectedActionIndex, selectedFrameIndex, 0];
            GrfImage image = layer.GetImage(act.Sprite);
            image.Convert(GrfImageType.Indexed8);
script can convert image to Indexed8
 it can run ,but when I want to save , will get a error
 
--------------         Exception         --------------
System.IndexOutOfRangeException: 
    GRF.FileFormats.SprFormat.SprAbstract._writeAsBgra32(BinaryWriter writer, GrfImage image)
    GRF.FileFormats.SprFormat.SprAbstract._saveAs(Spr spr, String filename, Byte major, Byte minor)
    GRF.FileFormats.SprFormat.SprConverterV2M1.Save(Spr spr, String filename)
    GRF.FileFormats.SprFormat.Spr.Save(String path)
    GRF.FileFormats.ActFormat.Act.SaveWithSprite(String actPath, String sprPath)
    ActEditor.Core.ActEditorWindow.SaveAs()
-------------------------------------------------------
 
I don't know how to change "writeAsBgra32" to "writeAsIndexed8".
have any one can teach me how to convert image in sprite correct ><"
thanks a lot.

 

Link to comment
Share on other sites

4 answers to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  16
  • Topics Per Day:  0.00
  • Content Count:  661
  • Reputation:   670
  • Joined:  11/12/12
  • Last Seen:  

You can simply right-click the image and convert it:

IdHG0jC.png

 

I'm not sure what you're trying to do here.

 

Edit: The script up there will break the SPR format. I should really remake that tool's interface, was a bit messy at the time.

Edited by Tokei
Link to comment
Share on other sites

  • 1

  • Group:  Members
  • Topic Count:  16
  • Topics Per Day:  0.00
  • Content Count:  661
  • Reputation:   670
  • Joined:  11/12/12
  • Last Seen:  

Bgra32 images take a lot more space than indexed8 images. Indexed8 images are RLE compressed while bgra32 images are just raw data. Either way, putting them in a GRF will compress your files so there's no real need to worry too much about that.

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  3
  • Topics Per Day:  0.00
  • Content Count:  5
  • Reputation:   0
  • Joined:  07/28/15
  • Last Seen:  

You can simply right-click the image and convert it:

IdHG0jC.png

 

I'm not sure what you're trying to do here.

 

Edit: The script up there will break the SPR format. I should really remake that tool's interface, was a bit messy at the time.

I have some .spr and i want to reduce they file size

original size is 392KB ,and after convert will become around 70KB

but have more then 300+ files and about 40 image in each spr file.....

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  3
  • Topics Per Day:  0.00
  • Content Count:  5
  • Reputation:   0
  • Joined:  07/28/15
  • Last Seen:  

Bgra32 images take a lot more space than indexed8 images. Indexed8 images are RLE compressed while bgra32 images are just raw data. Either way, putting them in a GRF will compress your files so there's no real need to worry too much about that.

Thank you for your comment.

 

BTW,I find a way to convert Indexed8.

just use PhotoShop convert image into indexed format ,and then add that into sprite,merge palette.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...