Jump to content

"Custom" filetype Issue


Recommended Posts

I have an issue with opening a game's "custom" image filetype in Paint.net

The image file in question IS actually just a renamed .png file, but Paint.net gives no dice.

The Game in Question:

Space Pirates And Zombies (by MinMax games)

Filetype in question:

.spz

Filetype details.

It's a .png file renamed to .spz. Renaming the file to .png allows paint.net to open it, but this is too much of an unwanted hassle. (Seeing I only want to open, copy and save as a NEW file)

It could also risk breaking the game if done wrong.

Is there a way to make Paint.net recognize this .spz file as a normal .png file (which it in fact is)?

Any help with this would be greatly apreciated by the SPAZ modding community.

I've checked through the plug-in availability and such, but couldn't find anything to help me further.

Link to comment
Share on other sites

if it is just a renamed .png and you want a new file, make a copy first, then rename the copy, then open and edit the copy.

 

what I do all summer Emote Cursor Pack 'noob gallery

No, Paint.NET is not spyware...but, installing it is an IQ test. ~BoltBait

Blend modes are like the filling in your sandwich. It's the filling that can change your experience of the sandwich. ~Ego Eram Reputo

Link to comment
Share on other sites

if it is just a renamed .png and you want a new file, make a copy first, then rename the copy, then open and edit the copy.

What I want is to open the file WITHOUT needing to do the copy and renaming first.

[edit]

Actually. your suggestion sound in the way like.

Hey. Just copy close to 2000 files and rename those back to .png, just so you can check up one or two of them for necessity.

Are YOU willing to do such an action?

Edited by GTX2GvO
Link to comment
Share on other sites

Are YOU willing to do such an action?

No, but Paint.NET is no tool to do mass-editing. Maybe you could use Irfanview which identifies the files by magic values in the files.

Or write your own filetype plugin. I guess it would take less than an hour if you have an idea about filetype plugins. You just have to route the file to the build-in png-loader.

midoras signature.gif

Link to comment
Share on other sites

Or write your own filetype plugin. I guess it would take less than an hour if you have an idea about filetype plugins.

I've checked the filetype plugin template.

I've checked the codeproject tutorial for it.

And I have no frigging clue on how to make a plugin.dll with it. (I've tried though with notepad++ And VS2010 C# Express)

Also. I'm no Programmer and thus don't know how to fix the errors in the "project" ( e.g. wtf rootnamespace error?! )

Seeing I first posted @10:19 Local time and it's now 16:21 local time I guess it ain't "Less then an hour".

Link to comment
Share on other sites

Seeing I first posted @10:19 Local time and it's now 16:21 local time I guess it ain't "Less then an hour".

I said if you have an idea about filetype plugins. Means you implemented one already...

So for a non programmer choose the other solution using a different application.

midoras signature.gif

Link to comment
Share on other sites

What I want is to open the file WITHOUT needing to do the copy and renaming first.

[edit]

Actually. your suggestion sound in the way like.

Hey. Just copy close to 2000 files and rename those back to .png, just so you can check up one or two of them for necessity.

Are YOU willing to do such an action?

I did not realize you had that many files to change, so there is no need to get snippy.

Also, I went through the list of supported filetypes in Irfanview, and I didn't see ".spz" in there. I would still recommend trying it just in case it recognizes that it is merely a .png file. If not, find someone that will write a program for you to view the images without changing the filetype.

Question: are you able to set windows to open the files with windows photo viewer? Right click on one of the files and go to properties. Next to "Opens with" click "change" and select windows photo viewer. If it works, great. If not, it was worth a try.

 

what I do all summer Emote Cursor Pack 'noob gallery

No, Paint.NET is not spyware...but, installing it is an IQ test. ~BoltBait

Blend modes are like the filling in your sandwich. It's the filling that can change your experience of the sandwich. ~Ego Eram Reputo

Link to comment
Share on other sites

Also, I went through the list of supported filetypes in Irfanview, and I didn't see ".spz" in there.

Trust me ;-) It is working. To make things easier you are able to add '.spz' to the file extensions in the IV options.

midoras signature.gif

Link to comment
Share on other sites

So. You guy's are telling me to use something ELSE then Paint.NET? :wtf:

I wouldn't come here to ask for assistance If i wanted that.

And windows Photo Viewer Only opens them. (it can't even save them to .png, which is needed for the files I want to edit them)

And, rather frankly, I don't want any image viewers.

I want to double click the damn file and if it's actually the right one, start editing it.

And because these files have quite some transparency in them I can't even just attach them to MS Paint.

(it can't save the transparency values)

Frustration. Lots of frustration.

Especially cause I don't know how to make a (considerably) easy filetype plugin.

(Really. the only thing it should do is tell paint.net that those spz's are nothing else then png's)

Why. Why isn't there a good tutorial. :sad:

Link to comment
Share on other sites

The reason I suggested an image viewer was because you wanted to look for the file that needed to be edited, then edit it. Right?

Since there is no .spz filetype plugin at the moment, we suggested image viewers so you can conveniently search through your .spz files for the one you want, then copy/rename ONE image instead of 2000. Until there is a more convenient solution, this would be a whole lot better than what you started with, no?

I do understand your frustration, but there is currently no way to make it work exactly how you want it. None. It does not exist. At least not until someone makes you a filetype plugin (you have to start asking nicely if you want that to happen, though)

 

what I do all summer Emote Cursor Pack 'noob gallery

No, Paint.NET is not spyware...but, installing it is an IQ test. ~BoltBait

Blend modes are like the filling in your sandwich. It's the filling that can change your experience of the sandwich. ~Ego Eram Reputo

Link to comment
Share on other sites

The reason I suggested an image viewer was because you wanted to look for the file that needed to be edited, then edit it. Right?

Yes. That's right, but I'd prefer that the step between viewing the image and actually editing it is as short as selecting the right tool. (And then save it in the right spot as .png)

Instead of closing the viewer. Go to the file. Copy it elsewhere. Rename to png. open with paint.net. edit. save. done.

Since there is no .spz filetype plugin at the moment, we suggested image viewers so you can conveniently search through your .spz files for the one you want, then copy/rename ONE image instead of 2000. Until there is a more convenient solution, this would be a whole lot better than what you started with, no?

Well. If I understood the filetype plugin making in a way I could make a basic one, it would've been done already.

(I can tweak existing code, but the template and tutorial require much better intel on the matter, which I don't have)

I do understand your frustration, but there is currently no way to make it work exactly how you want it. None. It does not exist. At least not until someone makes you a filetype plugin (you have to start asking nicely if you want that to happen, though)

The main reason to want a filetype plugin for the format is to Help out on the modding community of the Space Pirates And Zombies game.

Cause being able to open all the art assets in the program best advised for the task to edit the content is highly wanted.

Preferably, I would want to make the plugin myself. But I simply don't know how. (which is the frustrating part)

Therefor I'm basically at the mercy of anyone willing to help.

In all honestly. How hard is it to make a plugin using the above linked template and tutorial for a filetype (any) that is actually another (known by paint.net like png) filetype?

Or should just a whole different route be needed to be taken?

Link to comment
Share on other sites

Load is just something like

...

internal SPZFileType()

: base(

"SPZ - Space Pirates And Zombies format",

0

| FileTypeFlags.SupportsLoading

,

new[] { ".spz" })

{

}

...

protected override Document OnLoad(Stream input)

{

PngFileType pngft = new PngFileType();

Document doc = pngft.Load(input);

return doc;

}

Good luck.

midoras signature.gif

Link to comment
Share on other sites

Load is just something like

Good luck.

Had to check the bin folder of the VS 2010 C# Express project for the dll.

IT WORKS!

They open!

Just curious. How would the saving part needed to be constructed?

You know, that part that we left out.

The template has the following save part:

		protected override void OnSave(Document input, Stream output, SaveConfigToken token,
		Surface scratchSurface, ProgressEventHandler callback)
	{
		RenderArgs ra = new RenderArgs(new Surface(input.Size));
		input.Render(ra);

		ra.Bitmap.Save(output, ImageFormat.Bmp);
	}

If I interpret it correct that means this piece of code tries to save it as a bmp/bitmap?

@Rick: In case of this game it could be your worst enemy.

Forget to rename back. Game tries to look for the spz files. can't find them. Load's white boxes instead.

The renaming of the files is a step I try to AVOID. :)

(But they could be placed in two handy .bat files though if it was needed)

Edited by GTX2GvO
Link to comment
Share on other sites

Therefor I'm basically at the mercy of anyone willing to help.

You've had loads of high quality help in this thread. How about thanking them?

The best way to get people to help you is to say please and thank you.

Link to comment
Share on other sites

@Rick: In case of this game it could be your worst enemy.

Forget to rename back. Game tries to look for the spz files. can't find them. Load's white boxes instead.

It seems to me that Rick has the right idea. No fussin' with scripting or troubleshooting scripts, or anything else - afterall look how much you had to type out for the script, but Ricks suggestion is a ton fewer keystrokes and you can use Paint.net.

I find it hard to believe that after all that has been discussed here in regards to your issue that you would forget to rename the files back. Even if you did forget, you would immediately know and the command would be short and sweet to rename them back as you needed to - no more problem.

Link to comment
Share on other sites

Well .Then THANK you all .^_^

And please forgive me that I forgot to ask with please before.

:)

Just curious. How would the saving part needed to be constructed?

You know, that part that we left out.

The template has the following save part:

		protected override void OnSave(Document input, Stream output, SaveConfigToken token,
		Surface scratchSurface, ProgressEventHandler callback)
	{
		RenderArgs ra = new RenderArgs(new Surface(input.Size));
		input.Render(ra);

		ra.Bitmap.Save(output, ImageFormat.Bmp);
	}

If I interpret it correct that means this piece of code tries to save it as a bmp/bitmap?

Yes it does. This thread might be of interest: http://forums.getpai...38-ora-attempt/

It details how the ORA filetype plugin was developed

Link to comment
Share on other sites

You can put each of those statements (e.g., "ren *.spz *.png") into its own batch file. Let's say you call it "spz2png.bat" and "png2spz.bat". Then just run those. Even fewer keystrokes.

And as for the code samples, if you're working with PNG then you probably shouldn't tell it to save as ImageFormat.Bmp.

The Paint.NET Blog: https://blog.getpaint.net/

Donations are always appreciated! https://www.getpaint.net/donate.html

forumSig_bmwE60.jpg

Link to comment
Share on other sites

You can put each of those statements (e.g., "ren *.spz *.png") into its own batch file. Let's say you call it "spz2png.bat" and "png2spz.bat". Then just run those. Even fewer keystrokes.

With the current plugin that's no longer needed. ^_^

And as for the code samples, if you're working with PNG then you probably shouldn't tell it to save as ImageFormat.Bmp.

That's what I said underneath it and of course I know it would be wrong to save it like that. ;)

Are you implying it should be " ra.Bitmap.Save(output, ImageFormat.png); " instead?

Or maybe even " ra.pngft.Save(output, ImageFormat.png); "?

Or would I just end with blowing stuff up? :P

About the ORA plugin.

I have a oraFileType.cs file in my filetype folder.

It's content regarding saving confused me though.

So I hope that the Ora development thread could help me further. ^_^

Link to comment
Share on other sites

Yes it does. This thread might be of interest: http://forums.getpai...38-ora-attempt/

It details how the ORA filetype plugin was developed

Ok. Read through the thread.

Tried stuff. Failed

Tried somewhat different stuff. Failed more.

Tried "optimizing" old stuff. Failed harder.

Tried what was thought a cheap trick. Horrendously failed beyond comparison.

And all that time had no clue what the heck I was actually doing. :doh:

What the heck am I missing here?

(besides basic programming knowledge)

Link to comment
Share on other sites

I'll go straight to the point: I don't know much more than you when it comes to scripts, but it would be helpful to post the code you've put together. Maybe some typo exists or a statement is incomplete, etc. This will give somebody an opportunity to review it and possibly comment on it.

Edited by jim100361
Link to comment
Share on other sites

This is what I have now as "Best example" (least amount of errors and such) in Code.cs

But not working of course.

using System;
using System.Collections.Generic;
using System.Text;
using PaintDotNet;
using PaintDotNet.Data;
using System.IO;
using System.Drawing;
using System.Windows.Forms;
using System.Drawing.Imaging;
namespace PaintDotNet.Data
{
 public class SPZFileType : FileType
 {
	internal SPZFileType()
  : base(
  "SPAZ Image format",
  0
  | FileTypeFlags.SupportsLoading /* | FileTypeFlags.SupportsSaving */
  ,
  new[] { ".spz" })
{
}
 protected override Document OnLoad(Stream input)
  {
  PngFileType pngft = new PngFileType();
  Document doc = pngft.Load(input);
  return doc;
  }
/*
  protected override void OnSave(Document input, Stream output , SaveConfigToken token,
					Surface scratchSurface, ProgressEventHandler callback)
			{
				PngFileType pngft = new PngFileType();
				Document doc = pngft.Save(output, ImageFormat.Png);
			}

*/
		//Keep Save/load stuff above this line!!
	 }
public class SPZFileTypeFactory : IFileTypeFactory
{
	public FileType[] GetFileTypeInstances()
	{
		return new FileType[] { new SPZFileType() };
	}
}
}

I've currently (and deliberately) commented out the "Supportsaving" and "onSave" sections. (for now)

Amongst the "OnSave" Section still pops up the error: "No overload for method 'Save' takes 2 arguments"

Which is on the pngft.Save part.

This is the part where it still fails and is probably in it's entire wrong from the get go. (everything between { & } there)

Everything else works. (the .spz filetype is correctly opened by Paint.net)

Just due to the lack of a save section it can't be saved as .spz if wanted. (or force paint.net to show a "save as.." dialog instead, when trying to close with edits unsaved)

The "//Keep Save/load stuff above this line!!" is because my tweaking caused code to get underneath the "}" that is placed below it.

Which will breaks just about the whole file.

Link to comment
Share on other sites

I came across this thread (for what it's worth). Maybe there's something in the linked file there that may help you:

http://forums.getpai...n-template-v20/

It's where I got the Code.cs from (and the rest of the VS project) and I linked to that in post #5 (together with it's tutorial).

The OnSave there would try to save it as a bmp file and if you read a few posts above that wouldn't be the right practice.

The main issue is that I don't know how to do an OnSave to the png format instead. (I mean correctly)

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
Reply to this topic...

×   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.

 Share

×
×
  • Create New...