Jump to content
  • Advertisement
Sign in to follow this  
grumpyOldDude

How to convert jpg to snb

This topic is 1038 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Is there any library/code (compatible with java) available to convert a .jpg file format to .snb (S memo) format? (not the reverse direction)  

 

I normally use this for  compressed file ->bitmap->file compressed, but it hasn't got .snb

	 void save_bm_image( Bitmap gBitmap, String bname, String fname  ){
		
		File file = new File (bname, fname);   
		if (file.exists ()) file.delete (); 
		try {
		       FileOutputStream out = new FileOutputStream(file);
		       gBitmap.compress(Bitmap.CompressFormat.PNG, 90, out);
		       out.flush();
		       out.close();	
		} catch (Exception e) {
		       e.printStackTrace();
		}	
	}

Share this post


Link to post
Share on other sites
Advertisement
According to this android thread, an SNB is just a zip archive. If there isn't any other metadata required, stuff your jpg in a zip (no compression, 'cause jpg already lossy compressed) and save the zip with an snb extension.

Share this post


Link to post
Share on other sites

No.  The thread you referred to discussed how to open .snb on pc which is never the problem since you can export to jpg...  I want to convert the other way - from jpg to snb

Based on his link, I agree with fastcall. While that is what they're discussing, the solution says that renaming the .snb to .zip will allow it to be opened -- thus it's a logical step to assume the reverse is also true.

Follow his advice, and try to do the following:

1. Compress your .jpg file to .zip (e.g. using WinZip, WinRar, or whatever people use these days). If you can choose compression ratio, choose "None" or "Storage" or similar.

2. Rename your new .zip file to .snb.

 

EDIT: I accidentally a word.

Edited by Lactose!

Share this post


Link to post
Share on other sites

While any SNB file is a valid ZIP file, not every valid ZIP file is a valid SNB file. Consider that every JAR file is also a valid ZIP file - but you cannot just rename a JAR file to SNB and expect it to do anything useful in a Samsung Note smartphone. The links you have provided explain how to dig out useful media from an SNB file, but offer next to no help towards building a working SNB file from pre-existing media. Which is what the OP is trying to accomplish.

True, and good points smile.png

 

I accidentally down-voted your post instead of voting it up.

Could someone vote it up to balance it out, please?

Edited by Lactose!

Share this post


Link to post
Share on other sites

thanks fastcall22, Lactose!

 

and monophotonic

 

 

While any SNB file is a valid ZIP file, not every valid ZIP file is a valid SNB file. Consider that every JAR file is also a valid ZIP file - but you cannot just rename a JAR file to SNB and expect it to do anything useful in a Samsung Note smartphone. The links you have provided explain how to dig out useful media from an SNB file, but offer next to no help towards building a working SNB file from pre-existing media. Which is what the OP is trying to accomplish.
 
My advice to alwaysGrey is to make some SNB files with the kind of content you want your created files to have, and look into how the JPGs are stored in those. Then try to recreate that with your own code and check how well it works. When there are errors, create some more files with small differences around the erroneous bits and see how those change the resulting file.

 

great! thanks again, I will try this. Looks feasible though a bit less straight forward than i'd imagined

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!