SHARE
TWEET

TweetImager2

DavidRogers13s Oct 8th, 2014 (edited) 242 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace ImageCompression
  8. {
  9.     public class JPEGParser
  10.     {
  11.         private enum JPEGElementType
  12.         {
  13.             StartOfImage, StartOfFrameBaseline, StartOfFrameProgressive, DefineHuffmanTable, DefineQuantizationTable,
  14.             DefineRestartInterval, StartOfScan, Restart, ApplicationSpecific, Comment, EndOfImage, Padding
  15.         }
  16.  
  17.         private class JPEGMarker
  18.         {
  19.             public JPEGElementType Type { get; set; }
  20.             public bool VariableLength { get; set; }
  21.             public bool CoreElement { get; set; }
  22.         }
  23.  
  24.         private class JPEGElement
  25.         {
  26.             public byte Code { get; set; }
  27.             public JPEGMarker Type
  28.             {
  29.                 get
  30.                 {
  31.                     return JPEGTags[Code];
  32.                 }
  33.             }
  34.             public byte LenghtOne { get; set; }
  35.             public byte LenghtTwo { get; set; }
  36.             public IEnumerable<byte> Data { get; set; }
  37.         }
  38.  
  39.         private const byte TagMarker = 255;
  40.         private static readonly Dictionary<byte, JPEGMarker> JPEGTags = new Dictionary<byte, JPEGMarker>() {
  41.             {216, new JPEGMarker { Type = JPEGElementType.StartOfImage, VariableLength = false, CoreElement = false }},
  42.             {192, new JPEGMarker { Type = JPEGElementType.StartOfFrameBaseline,  VariableLength = true, CoreElement = true }},
  43.             {194, new JPEGMarker { Type = JPEGElementType.StartOfFrameProgressive, VariableLength = true, CoreElement = true }},
  44.             {196, new JPEGMarker { Type = JPEGElementType.DefineHuffmanTable, VariableLength = true, CoreElement = true }},
  45.             {219, new JPEGMarker { Type = JPEGElementType.DefineQuantizationTable, VariableLength = true, CoreElement = true }},
  46.             {221, new JPEGMarker { Type = JPEGElementType.DefineRestartInterval, VariableLength = true, CoreElement = true }},
  47.             {218, new JPEGMarker { Type = JPEGElementType.StartOfScan, VariableLength = true, CoreElement = true }},
  48.             {208, new JPEGMarker { Type = JPEGElementType.Restart, VariableLength = false, CoreElement = false }},
  49.             {209, new JPEGMarker { Type = JPEGElementType.Restart,  VariableLength = false, CoreElement = false }},
  50.             {210, new JPEGMarker { Type = JPEGElementType.Restart,  VariableLength = false, CoreElement = false }},
  51.             {211, new JPEGMarker { Type = JPEGElementType.Restart, VariableLength = false, CoreElement = false }},
  52.             {212, new JPEGMarker { Type = JPEGElementType.Restart, VariableLength = false, CoreElement = false }},
  53.             {213, new JPEGMarker { Type = JPEGElementType.Restart,  VariableLength = false, CoreElement = false }},
  54.             {214, new JPEGMarker { Type = JPEGElementType.Restart,  VariableLength = false, CoreElement = false }},
  55.             {215, new JPEGMarker { Type = JPEGElementType.Restart,  VariableLength = false, CoreElement = false }},            
  56.             {224, new JPEGMarker { Type = JPEGElementType.ApplicationSpecific,  VariableLength = true, CoreElement = false }},
  57.             {225, new JPEGMarker { Type = JPEGElementType.ApplicationSpecific, VariableLength = true, CoreElement = false }},
  58.             {226, new JPEGMarker { Type = JPEGElementType.ApplicationSpecific, VariableLength = true, CoreElement = false }},
  59.             {227, new JPEGMarker { Type = JPEGElementType.ApplicationSpecific,  VariableLength = true, CoreElement = false }},
  60.             {228, new JPEGMarker { Type = JPEGElementType.ApplicationSpecific,  VariableLength = true, CoreElement = false }},
  61.             {229, new JPEGMarker { Type = JPEGElementType.ApplicationSpecific,  VariableLength = true, CoreElement = false }},
  62.             {230, new JPEGMarker { Type = JPEGElementType.ApplicationSpecific,  VariableLength = true, CoreElement = false }},
  63.             {231, new JPEGMarker { Type = JPEGElementType.ApplicationSpecific,  VariableLength = true, CoreElement = false }},
  64.             {232, new JPEGMarker { Type = JPEGElementType.ApplicationSpecific, VariableLength = true, CoreElement = false }},
  65.             {233, new JPEGMarker { Type = JPEGElementType.ApplicationSpecific,  VariableLength = true, CoreElement = false }},
  66.             {234, new JPEGMarker { Type = JPEGElementType.ApplicationSpecific,  VariableLength = true, CoreElement = false }},
  67.             {235, new JPEGMarker { Type = JPEGElementType.ApplicationSpecific,  VariableLength = true, CoreElement = false }},
  68.             {236, new JPEGMarker { Type = JPEGElementType.ApplicationSpecific,  VariableLength = true, CoreElement = false }},
  69.             {237, new JPEGMarker { Type = JPEGElementType.ApplicationSpecific,  VariableLength = true, CoreElement = false }},
  70.             {238, new JPEGMarker { Type = JPEGElementType.ApplicationSpecific, VariableLength = true, CoreElement = false }},
  71.             {239, new JPEGMarker { Type = JPEGElementType.ApplicationSpecific,  VariableLength = true, CoreElement = false }},
  72.             {254, new JPEGMarker { Type = JPEGElementType.Comment,  VariableLength = true, CoreElement = false }},
  73.             {217, new JPEGMarker { Type = JPEGElementType.EndOfImage, VariableLength = false, CoreElement = false }}            
  74.         };
  75.  
  76.         //TODO this has four different HoffmanTables included I should label them all, maybe encapsulate them...
  77.         private static readonly byte[] DefaultHoffmanTables = new byte[] {
  78.             255, 196, 0, 31, 0, 0, 1, 5, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11,
  79.             255, 196, 0, 181, 16, 0, 2, 1, 3, 3, 2, 4, 3, 5, 5, 4, 4, 0, 0, 1, 125, 1, 2, 3, 0, 4, 17, 5, 18, 33, 49, 65, 6, 19, 81, 97, 7, 34, 113, 20, 50, 129, 145, 161, 8, 35, 66, 177, 193, 21, 82, 209, 240, 36, 51, 98, 114, 130, 9, 10, 22, 23, 24, 25, 26, 37, 38, 39, 40, 41, 42, 52, 53, 54, 55, 56, 57, 58, 67, 68, 69, 70, 71, 72, 73, 74, 83, 84, 85, 86, 87, 88, 89, 90, 99, 100, 101, 102, 103, 104, 105, 106, 115, 116, 117, 118, 119, 120, 121, 122, 131, 132, 133, 134, 135, 136, 137, 138, 146, 147, 148, 149, 150, 151, 152, 153, 154, 162, 163, 164, 165, 166, 167, 168, 169, 170, 178, 179, 180, 181, 182, 183, 184, 185, 186, 194, 195, 196, 197, 198, 199, 200, 201, 202, 210, 211, 212, 213, 214, 215, 216, 217, 218, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250,
  80.             255, 196, 0, 31, 1, 0, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11,
  81.             255, 196, 0, 181, 17, 0, 2, 1, 2, 4, 4, 3, 4, 7, 5, 4, 4, 0, 1, 2, 119, 0, 1, 2, 3, 17, 4, 5, 33, 49, 6, 18, 65, 81, 7, 97, 113, 19, 34, 50, 129, 8, 20, 66, 145, 161, 177, 193, 9, 35, 51, 82, 240, 21, 98, 114, 209, 10, 22, 36, 52, 225, 37, 241, 23, 24, 25, 26, 38, 39, 40, 41, 42, 53, 54, 55, 56, 57, 58, 67, 68, 69, 70, 71, 72, 73, 74, 83, 84, 85, 86, 87, 88, 89, 90, 99, 100, 101, 102, 103, 104, 105, 106, 115, 116, 117, 118, 119, 120, 121, 122, 130, 131, 132, 133, 134, 135, 136, 137, 138, 146, 147, 148, 149, 150, 151, 152, 153, 154, 162, 163, 164, 165, 166, 167, 168, 169, 170, 178, 179, 180, 181, 182, 183, 184, 185, 186, 194, 195, 196, 197, 198, 199, 200, 201, 202, 210, 211, 212, 213, 214, 215, 216, 217, 218, 226, 227, 228, 229, 230, 231, 232, 233, 234, 242, 243, 244, 245, 246, 247, 248, 249, 250
  82.         };
  83.  
  84.         private static IEnumerable<JPEGElement> ParseJPEGData(byte[] input)
  85.         {
  86.             List<JPEGElement> results = new List<JPEGElement>();
  87.             for (int i = 0; i < input.Length; )
  88.             {
  89.                 if (input[i] == TagMarker && JPEGTags.ContainsKey(input[i + 1]))
  90.                 {
  91.                     if (!JPEGTags[input[i + 1]].VariableLength)
  92.                     {
  93.                         results.Add(new JPEGElement { Code = input[i + 1] });
  94.                         i += 2;
  95.                         continue;
  96.                     }
  97.                     else
  98.                     {
  99.                         var newElement = new JPEGElement
  100.                         {
  101.                             Code = input[i + 1],
  102.                             LenghtOne = input[i + 2],
  103.                             LenghtTwo = input[i + 3],
  104.                             Data = new List<byte>()
  105.                         };
  106.                         results.Add(newElement);
  107.                         i += 4;
  108.                         continue;
  109.                     }
  110.                 }
  111.                 else
  112.                 {
  113.                     //Some images have data after tags that shouldn't contain data
  114.                     //TODO log this somehow or something, here I'm just throwing it away
  115.                     if (results.Last().Data != null) ((List<byte>)results.Last().Data).Add(input[i]);
  116.                     i++;
  117.                 }
  118.             }
  119.             return results;
  120.         }
  121.         private static IEnumerable<byte> JPEGElementToByteArray(JPEGElement input)
  122.         {
  123.             return (new byte[] { TagMarker, JPEGTags.First(a => a.Value.Type == input.Type.Type).Key, input.LenghtOne, input.LenghtTwo }).Concat(input.Data).ToArray();
  124.         }
  125.         private static IEnumerable<byte> JPEGElementsToByteArray(JPEGElement[] input)
  126.         {
  127.             return input.SelectMany(element => element.Type.VariableLength ?
  128.                 (new byte[] { TagMarker, JPEGTags.First(a => a.Value.Type == element.Type.Type).Key, element.LenghtOne, element.LenghtTwo }).Concat(element.Data).ToArray() :
  129.                 (new byte[] { TagMarker, element.Code }));
  130.         }
  131.  
  132.  
  133.         /// <summary>
  134.         /// This method will strip all not image data from the image, attempting to make it as small as possible
  135.         /// </summary>
  136.         /// <param name="parsedInput">The JPEG image in a byte array</param>
  137.         /// <returns>A minimized version, only readable by the complimentery "RestoreJPEGDataFromMinimized"</returns>
  138.         public static IEnumerable<byte> MinimizeJPEGData(byte[] input)
  139.         {
  140.             var parsedInput = ParseJPEGData(input).ToArray();
  141.             var header = parsedInput.First(a => a.Type.Type == JPEGElementType.StartOfFrameBaseline);
  142.             var smallestScan = parsedInput.Where(a => a.Type.Type == JPEGElementType.StartOfScan).OrderBy(a => a.Data.Count()).First();
  143.  
  144.             return (new byte[] {
  145.                 //Height
  146.                 header.Data.ToArray()[2],
  147.                 //Width
  148.                 header.Data.ToArray()[4],          
  149.                 //TODO: very hacky right now, don't knwo what this does
  150.                 header.Data.ToArray()[7]})
  151.  
  152.                 //Now for the StartOfScan, this all needs to be saved except the length 1(assume this is never greater than 255)                
  153.                 .Concat(new byte[] { smallestScan.LenghtTwo })
  154.                 .Concat(smallestScan.Data.ToArray());
  155.         }
  156.         /// <summary>
  157.         /// This method will change code genereated from "MinimizeJPEGData" to a readable JPEG byte array
  158.         /// </summary>
  159.         /// <param name="input">The minimized JPEG image</param>
  160.         /// <returns>Array of bytes constituting a image</returns>
  161.         public static IEnumerable<byte> RestoreJPEGDataFromMinimized(byte[] input)
  162.         {
  163.             //TODO lots of hard coding going on here very unreadable, need to improve this
  164.             var results = new List<byte>();
  165.  
  166.             //Get basic info
  167.             byte height = input[0];
  168.             byte width = input[1];                        
  169.             byte headerInfo = input[2];
  170.  
  171.             //Add startFile
  172.             results.Add(TagMarker);
  173.             results.Add(JPEGTags.First(tag => tag.Value.Type == JPEGElementType.StartOfImage).Key);
  174.  
  175.             //Add basic QuantizationTables, when quality = 0 these almost always contain 255's
  176.             results.AddRange(new byte[] { 255, 219, 0, 67, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 });
  177.             results.AddRange(new byte[] { 255, 219, 0, 67, 1, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 });
  178.  
  179.             //Add header information
  180.             results.AddRange(new byte[] { 255, 192, 0, 17, 8, 0, height, 0, width, 3, 1, headerInfo, 0, 2, 17, 1, 3, 17, 1 });
  181.  
  182.             //Add Custom HoffmanTables
  183.             results.AddRange(DefaultHoffmanTables);
  184.  
  185.             //Very Important StartOfScan
  186.             results.AddRange(new byte[] { 255, 218, 0 });            
  187.             results.AddRange(input.Skip(3).ToArray());
  188.  
  189.             //Add endFile
  190.             results.Add(TagMarker);
  191.             results.Add(JPEGTags.First(tag => tag.Value.Type == JPEGElementType.EndOfImage).Key);
  192.  
  193.             return results;
  194.         }
  195.     }
  196. }
  197.  
  198.  
  199.  
  200.  
  201.  
  202. using System;
  203. using System.Collections;
  204. using System.Collections.Generic;
  205. using System.ComponentModel;
  206. using System.Data;
  207. using System.Drawing;
  208. using System.Drawing.Imaging;
  209. using System.IO;
  210. using System.IO.Compression;
  211. using System.Linq;
  212. using System.Text;
  213. using System.Threading.Tasks;
  214. using System.Windows.Forms;
  215. using ImageMagick;
  216.  
  217. namespace ImageCompression
  218. {
  219.     public partial class TweetImager : Form
  220.     {
  221.         public TweetImager()
  222.         {
  223.             InitializeComponent();
  224.         }
  225.  
  226.         private void LoadImageButton_Click(object sender, EventArgs e)
  227.         {
  228.             ImageOpenFileDialog.ShowDialog();
  229.         }
  230.  
  231.         private void ImageOpenFileDialog_FileOk(object sender, CancelEventArgs e)
  232.         {
  233.             int resizeDimension = 75;
  234.             using (MagickImage imageOriginal = new MagickImage(ImageOpenFileDialog.FileName))
  235.             using (MemoryStream ms = new MemoryStream())
  236.             {
  237.                 do
  238.                 {
  239.                     using (var image = new MagickImage(imageOriginal))
  240.                     {
  241.                         //Clear the memorystream
  242.                         ms.SetLength(0);
  243.  
  244.                         //Resize the image
  245.                         image.Resize(new MagickGeometry(resizeDimension));                        
  246.  
  247.                         // Sets the output format to jpeg
  248.                         image.Format = MagickFormat.Jpeg;                        
  249.                         image.Quality = 1;
  250.  
  251.                         //Use default Hoffman table, do not optimize(this allows use to cache the Hoffmantables and not encode them)
  252.                         image.SetDefine(MagickFormat.Jpeg, "optimize-coding", "off");                        
  253.  
  254.                         // Write the image to the memorystream
  255.                         image.Write(ms);
  256.                        
  257.                         //Encode it too text
  258.                         TweetRichTextBox.Text = EncodeBytesToAscii(JPEGParser.MinimizeJPEGData(ms.ToArray()).ToArray());                        
  259.                     }
  260.                     resizeDimension--;
  261.                 }
  262.                 //Reduce the image size until the output text is less than or equal to 140 characters(including height and width parameters)
  263.                 while (TweetRichTextBox.Text.ToCharArray().Length > 140);
  264.             }
  265.         }
  266.  
  267.         private void TranslateButton_Click(object sender, EventArgs e)
  268.         {
  269.             //TODO Will blow up if no file is selected, this all needs to be made better
  270.             var newFileName = ImageOpenFileDialog.FileName.Split('.')[0] + "1.png";
  271.  
  272.             //Now get the image from the ascii text
  273.             var data = DeencodeAsciiToBytes(TweetRichTextBox.Text).ToArray();
  274.             var file = JPEGParser.RestoreJPEGDataFromMinimized(data).ToArray();
  275.  
  276.             //Blow up the picture so its easier to see        
  277.             var enlaregedResult = new MagickImage(new Bitmap(new Bitmap(new MemoryStream(file)), new Size { Height = data[0] * 4, Width = data[1] * 4 }));
  278.             //Blur helps soften some of the compression
  279.             enlaregedResult.GaussianBlur(7, 35);
  280.             TweetImagePictureBox.Image = enlaregedResult.ToBitmap();
  281.             if (SaveCheckBox.Checked) enlaregedResult.ToBitmap().Save(newFileName, ImageFormat.Png);
  282.         }
  283.  
  284.  
  285.         //Ascii Converter
  286.         private static string EncodeBytesToAscii(byte[] input)
  287.         {
  288.             //Not sure this is exactly the most efficient way to store data within range 0-94, should at least be close(I hope)      
  289.             List<byte> output = new List<byte>();
  290.             var parsedToBits = input.SelectMany(GeneralHelperFunctions.GetBits).ToList();
  291.  
  292.             //Numbers between 94 and 64 should be 7, ones below should be 6, if a number is over 94 take 6 automatically making it less than 64
  293.             for (int i = 0; i < parsedToBits.Count(); )
  294.             {
  295.                 if (i + 6 < parsedToBits.Count())
  296.                 {
  297.                     if (GeneralHelperFunctions.ConvertBitArraytoByte(parsedToBits.GetRange(i, 7).ToArray()) > 94 ||
  298.                         GeneralHelperFunctions.ConvertBitArraytoByte(parsedToBits.GetRange(i, 7).ToArray()) < 64)
  299.                     {
  300.                         output.Add(GeneralHelperFunctions.ConvertBitArraytoByte(parsedToBits.GetRange(i, 6).ToArray()));
  301.                         i = i + 6;
  302.                     }
  303.                     else
  304.                     {
  305.                         output.Add(GeneralHelperFunctions.ConvertBitArraytoByte(parsedToBits.GetRange(i, 7).ToArray()));
  306.                         i = i + 7;
  307.                     }
  308.                 }
  309.                 else
  310.                 {
  311.                     output.Add(GeneralHelperFunctions.ConvertBitArraytoByte(parsedToBits.GetRange(i, parsedToBits.Count() - i).ToArray()));
  312.                     break;
  313.                 }
  314.             }
  315.  
  316.             //Add 32 to each number and convert to a character, this should output ASCII characters now
  317.             return String.Join("", output.Select(a => (char)(a + 32)));
  318.         }
  319.  
  320.         private static IEnumerable<byte> DeencodeAsciiToBytes(string input)
  321.         {
  322.             //Pretty much the opposite of "EncodeBytesToAscii", based on number size pulls all bits from the inputed charcters,
  323.             //then flattens the output and splits by 8 to convert back to base 255
  324.             var result = new List<byte>();
  325.  
  326.             var inputList = input.ToCharArray()
  327.                 .Select(a => ((int)a - 32))
  328.                 .SelectMany(a => a >= 64 ? GeneralHelperFunctions.GetBits((byte)a).Skip(1).ToArray() : GeneralHelperFunctions.GetBits((byte)a).Skip(2).ToArray())
  329.                 .ToList();
  330.  
  331.             for (int i = 0; i < inputList.Count; i = i + 8)
  332.             {
  333.                 if (inputList.Count - i < 8) result.Add(GeneralHelperFunctions.ConvertBitArraytoByte(inputList.GetRange(i, inputList.Count - i).ToArray()));
  334.                 else result.Add(GeneralHelperFunctions.ConvertBitArraytoByte(inputList.GetRange(i, 8).ToArray()));
  335.             }
  336.  
  337.             return result.ToArray();
  338.         }
  339.     }
  340. }
  341.  
  342.  
  343.  
  344. using System;
  345. using System.Collections.Generic;
  346. using System.Linq;
  347. using System.Text;
  348. using System.Threading.Tasks;
  349.  
  350. namespace ImageCompression
  351. {
  352.     class GeneralHelperFunctions
  353.     {
  354.         //Bit/Byte/Char converters
  355.         public static byte ConvertBitArraytoByte(bool[] bits)
  356.         {
  357.             if (bits.Length > 8)
  358.                 throw new ArgumentException("No arrays larger than 8 allowed!");
  359.             int result = 0;
  360.             double multiplier = Math.Pow(2, bits.Length - 1);
  361.             foreach (var element in bits)
  362.             {
  363.                 if (element) result += (int)multiplier;
  364.                 multiplier = multiplier / 2;
  365.             }
  366.             return (byte)result;
  367.         }
  368.  
  369.         public static IEnumerable<bool> GetBits(byte b)
  370.         {
  371.             for (int i = 0; i < 8; i++)
  372.             {
  373.                 yield return (b & 0x80) != 0;
  374.                 b *= 2;
  375.             }
  376.         }
  377.     }
  378. }
  379.  
  380.  
  381.  
  382.  
  383. using System;
  384. using System.Collections.Generic;
  385. using System.Linq;
  386. using System.Threading.Tasks;
  387. using System.Windows.Forms;
  388.  
  389. namespace ImageCompression
  390. {
  391.     static class Program
  392.     {
  393.         /// <summary>
  394.         /// The main entry point for the application.
  395.         /// </summary>
  396.         [STAThread]
  397.         static void Main()
  398.         {
  399.             Application.EnableVisualStyles();
  400.             Application.SetCompatibleTextRenderingDefault(false);
  401.             Application.Run(new TweetImager());
  402.         }
  403.     }
  404. }
  405.  
  406.  
  407.  
  408.  
  409. namespace ImageCompression
  410. {
  411.     partial class TweetImager
  412.     {
  413.         /// <summary>
  414.         /// Required designer variable.
  415.         /// </summary>
  416.         private System.ComponentModel.IContainer components = null;
  417.  
  418.         /// <summary>
  419.         /// Clean up any resources being used.
  420.         /// </summary>
  421.         /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
  422.         protected override void Dispose(bool disposing)
  423.         {
  424.             if (disposing && (components != null))
  425.             {
  426.                 components.Dispose();
  427.             }
  428.             base.Dispose(disposing);
  429.         }
  430.  
  431.         #region Windows Form Designer generated code
  432.  
  433.         /// <summary>
  434.         /// Required method for Designer support - do not modify
  435.         /// the contents of this method with the code editor.
  436.         /// </summary>
  437.         private void InitializeComponent()
  438.         {
  439.             this.LoadImageButton = new System.Windows.Forms.Button();
  440.             this.ImageOpenFileDialog = new System.Windows.Forms.OpenFileDialog();
  441.             this.TweetImagePictureBox = new System.Windows.Forms.PictureBox();
  442.             this.TweetRichTextBox = new System.Windows.Forms.RichTextBox();
  443.             this.TweetLabel = new System.Windows.Forms.Label();
  444.             this.TranslateButton = new System.Windows.Forms.Button();
  445.             this.SaveCheckBox = new System.Windows.Forms.CheckBox();
  446.             ((System.ComponentModel.ISupportInitialize)(this.TweetImagePictureBox)).BeginInit();
  447.             this.SuspendLayout();
  448.             //
  449.             // LoadImageButton
  450.             //
  451.             this.LoadImageButton.Location = new System.Drawing.Point(58, 13);
  452.             this.LoadImageButton.Name = "LoadImageButton";
  453.             this.LoadImageButton.Size = new System.Drawing.Size(75, 23);
  454.             this.LoadImageButton.TabIndex = 0;
  455.             this.LoadImageButton.Text = "LoadImage";
  456.             this.LoadImageButton.UseVisualStyleBackColor = true;
  457.             this.LoadImageButton.Click += new System.EventHandler(this.LoadImageButton_Click);
  458.             //
  459.             // ImageOpenFileDialog
  460.             //
  461.             this.ImageOpenFileDialog.FileName = "ImageOpenFileDialog";
  462.             this.ImageOpenFileDialog.FileOk += new System.ComponentModel.CancelEventHandler(this.ImageOpenFileDialog_FileOk);
  463.             //
  464.             // TweetImagePictureBox
  465.             //
  466.             this.TweetImagePictureBox.Location = new System.Drawing.Point(12, 147);
  467.             this.TweetImagePictureBox.Name = "TweetImagePictureBox";
  468.             this.TweetImagePictureBox.Size = new System.Drawing.Size(250, 250);
  469.             this.TweetImagePictureBox.TabIndex = 3;
  470.             this.TweetImagePictureBox.TabStop = false;
  471.             //
  472.             // TweetRichTextBox
  473.             //
  474.             this.TweetRichTextBox.Location = new System.Drawing.Point(12, 41);
  475.             this.TweetRichTextBox.Name = "TweetRichTextBox";
  476.             this.TweetRichTextBox.Size = new System.Drawing.Size(250, 75);
  477.             this.TweetRichTextBox.TabIndex = 4;
  478.             this.TweetRichTextBox.Text = "";
  479.             //
  480.             // TweetLabel
  481.             //
  482.             this.TweetLabel.AutoSize = true;
  483.             this.TweetLabel.Location = new System.Drawing.Point(12, 22);
  484.             this.TweetLabel.Name = "TweetLabel";
  485.             this.TweetLabel.Size = new System.Drawing.Size(40, 13);
  486.             this.TweetLabel.TabIndex = 5;
  487.             this.TweetLabel.Text = "Tweet:";
  488.             //
  489.             // TranslateButton
  490.             //
  491.             this.TranslateButton.Location = new System.Drawing.Point(12, 122);
  492.             this.TranslateButton.Name = "TranslateButton";
  493.             this.TranslateButton.Size = new System.Drawing.Size(75, 23);
  494.             this.TranslateButton.TabIndex = 6;
  495.             this.TranslateButton.Text = "Translate";
  496.             this.TranslateButton.UseVisualStyleBackColor = true;
  497.             this.TranslateButton.Click += new System.EventHandler(this.TranslateButton_Click);
  498.             //
  499.             // SaveCheckBox
  500.             //
  501.             this.SaveCheckBox.AutoSize = true;
  502.             this.SaveCheckBox.Location = new System.Drawing.Point(93, 126);
  503.             this.SaveCheckBox.Name = "SaveCheckBox";
  504.             this.SaveCheckBox.Size = new System.Drawing.Size(51, 17);
  505.             this.SaveCheckBox.TabIndex = 7;
  506.             this.SaveCheckBox.Text = "Save";
  507.             this.SaveCheckBox.UseVisualStyleBackColor = true;
  508.             //
  509.             // TweetImager
  510.             //
  511.             this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
  512.             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
  513.             this.ClientSize = new System.Drawing.Size(284, 411);
  514.             this.Controls.Add(this.SaveCheckBox);
  515.             this.Controls.Add(this.TranslateButton);
  516.             this.Controls.Add(this.TweetLabel);
  517.             this.Controls.Add(this.TweetRichTextBox);
  518.             this.Controls.Add(this.TweetImagePictureBox);
  519.             this.Controls.Add(this.LoadImageButton);
  520.             this.Name = "TweetImager";
  521.             this.Text = "TweetImager";
  522.             ((System.ComponentModel.ISupportInitialize)(this.TweetImagePictureBox)).EndInit();
  523.             this.ResumeLayout(false);
  524.             this.PerformLayout();
  525.  
  526.         }
  527.  
  528.         #endregion
  529.  
  530.         private System.Windows.Forms.Button LoadImageButton;
  531.         private System.Windows.Forms.OpenFileDialog ImageOpenFileDialog;
  532.         private System.Windows.Forms.PictureBox TweetImagePictureBox;
  533.         private System.Windows.Forms.RichTextBox TweetRichTextBox;
  534.         private System.Windows.Forms.Label TweetLabel;
  535.         private System.Windows.Forms.Button TranslateButton;
  536.         private System.Windows.Forms.CheckBox SaveCheckBox;
  537.     }
  538. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top