"Size of the bitmap is illegal"

I'm currently translating an RM2k game wich has almost all the image files in .xyz format.
I'm able to export them as .png/.bpm files, but after i edit them i can turn them back in .xyz files. This message box appears: "The size of the bitmap is illegal".
I've tried to save it as both .png and .bpm, leave it with index colors/ 256 colors, and nothing seems to work.
Any help?
Try import this as picture or panorama (in this type of resources size of graphics is the biggest - max 640x480 pixels). If you have more biggest of graphics I think that is a custom program for change a format, I maybe somewhere have this.
Basically, the images should be the exactly same size as they were before being edited.
Each resource type should match the size specified for its type (charset, tileset, etc).
And you don't need to import xyz files. They are just plain bmp files with renamed extensions by the engine.

Edit:
Forget what I said before =p
My life was a lie all along.
No, this isn't a simple renamed extension, if this will be this - you can change extension in you own and this should be OK, but this not work.

"XYZ is a graphics format made for RPG Maker 2000 and 2003. RPG Maker can import and export graphics supported by RPG Maker in this format. The features are 8 bit palette and a maximum of 65536x65536 pixels."

https://rpgmaker.net/forums/topics/24106/
A bit late, but in case someone else is looking for a solution too: You can use this tool to convert between PNG and XYZ outside of the RPG Maker. You have to drag and drop the file into the tool.

Original thread: https://forums.rpgmakerweb.com/threads/size-of-the-bitmap-is-illegal.106273/