the file is Binary. the problem is that my program is distribute to a lot of people, and i have a problem when tomorrow microsoft develop 4.00 or 5.00 or 6.00 framework version, and i can't compatible my old version to the new one.
nryk
Posts
-
Deserialize from 2.0 to 1.1 framework -
Deserialize from 2.0 to 1.1 frameworki'm using 1.1 framework and my customer using 2.00 framework. he is saveing a Serialized file that have MemoryStream. when i'm trying to Deserialize the file i get an Exception. (if i try to Deserialize in 2.00 framework it's ok) how can i Deserialize in 1.1 framework ?
-
png to jpghi how can i convert image that is 32bppArgb (png image) to jpg so if the image is Transparent i don't get a black image, or if the image is semi Transparent (like red color and 50 % alpha) i get the color like the png image and not a full color?
-
GraphicsPath.AddString vs Graphics.MeasureStringhi why does this fonction don't retrieve the same result as Graphics.MeasureString ? public RectangleF MeasureString (string str,Font f) { using (GraphicsPath gp = new GraphicsPath()) { gp.AddString(str,f.FontFamily,(int)f.Style,(300 / 72) * f.Size,new Point(0,0),new StringFormat()); // i'm using 300 dpi return gp.GetBounds(); } }
-
measure stringi'm using 1.1 Framework, so i think i can't use it :-(
-
measure stringhi how can i measure string height without using Graphics.MeasureString()? i've tried to use GraphicsPath and AddString() then to GetBounds() but that gives me the exact height, but i need the height like MeasureString() function. the reason i can't use Graphics is that i need to calculate something about the string height in a function that doesn't get Graphics variable. (in the function that does have the Graphics variable i'm using 300 dpi).
-
Rotating Ellipse in bounded Rectanglehi with GraphicsPath.AddEllipse i created ellipse,if i use GetBounds() i get the bounds of the ellipse, now if i want to rotate the ellipse keeping the same bounding rectangle how do i calculate the new ellipse to create?
-
load a lot of Images to memoryGuffa wrote:
Another alternative that is a bit more promising would be to extract the color data and alpha channel separately, and compress the color data as a regular JPEG image and the alpha data as a grayscale JPEG image.
and how do i do that ? and how do i combine them together later ? is it with LockBits? and run through every "Pixel" ? is there any other file type like png that have the alpha channel and still remain small size ?
-
load a lot of Images to memoryi managed to see the problem: i'm loading jpg files, but in my app i need it as png file ( because of the alpha channel )so when i save it to the memoryStreem as ImageFormat.Png the png is less compressed,is it possible to compress the png file to something like 0.5 mb - 1 mb like jpg ?
-
load a lot of Images to memoryi need the png format because i'm useing the alpha channel. how does other programs do that ? for example powerPoint ? in powerPoint i can put tens of images and the memory grows only with a few mb ?
-
load a lot of Images to memoryhi i want to load a lot of images to the memory. of course every bitmap in the memory takes about 10 times more then in the file; so (if there is no other way) i'm loading the image as a byte array: private byte[] FileToByteArray (string path) { byte[] bytes = null; using (System.IO.Stream stream = File.OpenRead(path)) { using (System.IO.BinaryReader reader = new BinaryReader(stream)) { bytes = reader.ReadBytes((int)reader.BaseStream.Length); } } return bytes; } and store it into a byte array variable. when i need the image i use: private Image ByteArrayToImage(byte[] byteArrayIn) { if (byteArrayIn == null) return null; MemoryStream ms = new MemoryStream(byteArrayIn); Image returnImage = Image.FromStream(ms); return returnImage; } so far so good, the problem is if the image need to be change i send it to a function and get new bitmap, now i want to save it back to byte array, so if i use: private byte[] ImageToByteArray(System.Drawing.Image imageIn) { if (imageIn == null) return null; MemoryStream ms = new MemoryStream(); imageIn.Save(ms,System.Drawing.Imaging.ImageFormat.Png); imageIn.Dispose(); return ms.ToArray(); } i get a byte array that is about 10 times bigger. so how can i get a smaller byte array?