Jump to content

jerone

Members
  • Posts

    11
  • Joined

  • Last visited

Posts posted by jerone

  1. On 9/24/2020 at 5:52 PM, RikTrik said:

    I was wondering whether you could add the ability to change canvas size using the mouse, I'm not very good at guessing how far across 852 pixels is.

    Yes, this would be very useful for me too. 👍

     

    Now, I usually double the sizes or add another 1000 pixels, just to get enough room. And then later "Crop to Selection" to get the desired size.

    With this suggestion, it would simplify this process.

  2. I have a bug report:

     

    I used to copy-paste an image from Firefox into a blank image in Paint.net. But with the latest beta I get an error saying:

    This clipboard doesn't contain an image.

     

    Steps to reproduce:

    1. Open http://www.getpaint.net into a tab in Firefox.
    2. Right-click the image on that page and press "Copy image".
    3. Go to Paint.net program and paste the image (Ctrl + v or paste from menu) into a blank canvas.
    4. See the error message as above show up.

    Environment:

    • Firefox 28 & 29
    • Windows 7 & 8.1
    • Paint.net 4.0.5168

    Edit:

    Just noticed this topic: http://forums.getpaint.net/index.php?/topic/28027-bug-image-copying-from-firefox/

  3. Great tool! Keep up the great work.

     

    Small bug; when installing I checked the option to check for pre-releases (beta), but when opening the settings window, this option isn't checked.

     

    Another small bug; languages dropdown doesn't show current language (see attachment). Does show again when opening dropdown.

    Steps to reproduce:

    1. Open Settings window.
    2. Select another tab then "User Interface".
    3. Close Settings window.
    4. Open Settings window.
    5. Select tab "User Interface" and see clear language dropdown.

     

    Also, I have one feature request. Can you add a confirm message after opening multiple files (without editing) and pressing the program close button.

     

    Specs:

    paint.net 4.0 alpha build 5086

    Windows 7 SP1

    post-110866-0-00015400-1386353528_thumb.

  4.  

    I was just in the progress of building my own (see code below), but yours works great with the extra option for file type.

     

    using System;
    using System.Drawing;
    using System.Drawing.Imaging;
    using System.IO;
    using System.Text;
    using System.Windows.Forms;
    
    namespace PaintDotNet.Plugin.FileTypes
    {
    	/// <summary>
    	/// Base64 file type
    	/// </summary>
    	public class Base64FileType : FileType
    	{
    		#region Constructor;
    
    		/// <summary>
    		/// Base64 file type
    		/// </summary>
    		public Base64FileType() : base("Base64", FileTypeFlags.SupportsLoading | FileTypeFlags.SupportsSaving, new String[] { ".txt" }) { }
    
    		#endregion Constructor;
    
    		#region Override;
    
    		/// <summary>
    		/// Open file
    		/// </summary>
    		/// <param name="input"></param>
    		/// <returns></returns>
    		protected override Document OnLoad(Stream input)
    		{
    			try
    			{
    				// Convert byte[] string to Base64;
    				StreamReader reader = new StreamReader(input);
    				String base64String = reader.ReadToEnd();
    				base64String = base64String.Replace("data:image/png;base64,", "");
    
    				// Convert Base64 string to byte[];
    				byte[] imageBytes = Convert.FromBase64String(base64String);
    				MemoryStream ms = new MemoryStream(imageBytes, 0, imageBytes.Length);
    
    				// Convert byte[] to Image;
    				ms.Write(imageBytes, 0, imageBytes.Length);
    				Image image = Image.FromStream(ms, true);
    
    				return Document.FromImage(image);
    			}
    			catch
    			{
    				MessageBox.Show("Problem Importing File");
    
    				Bitmap b = new Bitmap(500, 500);
    				return Document.FromImage(;
    			}
    		}
    
    		/// <summary>
    		/// Save file
    		/// </summary>
    		/// <param name="input"></param>
    		/// <param name="output"></param>
    		/// <param name="token"></param>
    		/// <param name="scratchSurface"></param>
    		/// <param name="callback"></param>
    		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, true);
    
    			using (MemoryStream ms = new MemoryStream())
    			{
    				// Convert Image to byte[];
    				ra.Bitmap.Save(ms, ImageFormat.Gif);
    				Byte[] imageBytes = ms.ToArray();
    
    				// Convert byte[] to Base64 string;
    				String base64String = "data:image/png;base64," + Convert.ToBase64String(imageBytes);
    
    				// Convert Base64 string to byte[];
    				ASCIIEncoding encoding = new ASCIIEncoding();
    				Byte[] stringBytes = encoding.GetBytes(base64String);
    
    				// Save to stream;
    				output.Write(stringBytes, 0, stringBytes.Length);
    			}
    		}
    
    		#endregion Override;
    	}
    
    	public class Base64FileTypeFactory : IFileTypeFactory
    	{
    		public FileType[] GetFileTypeInstances()
    		{
    			return new FileType[] { new Base64FileType() };
    		}
    	}
    }
    
    
  5. It would be an interesting filetype plugin. I'm sure one of the filetype plugin authors could knocking something like this out in just a few minutes.

     

    So this is possible with plugins?

    Can you point me in the right direction for documentation about how I can make a save-as plugin, and I mite have a go myself...

×
×
  • Create New...