|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
saved bitmap sizeHi group, I've got a question about the size of a saved bitmap.
What I need to do is open a bitmap if it needs resizing, resize and save it. This isn't a problem, but the problem I have is that the original image has got an 8 bit indexed pixelformat, but you can't create a graphics object for this pixelformat so my bitmap uses the default pixelformat: Format32bppArgb, but this ofcourse result in a much larger file size (420kB instead of 106kB) I know I can use for example Format24bppRgb and this reduces the size to 300kB but I would like to know if I there's a way I can keep the size at 106kB Thanks in advance Greetz Peter i proost,
i created compressed bmp. there is not control to be added. Option Explicit On Option Strict Off Imports System.Drawing.Imaging Imports System.IO Module ImageCompression Private Function GetEncoderInfo(ByVal mimeType As String) As ImageCodecInfo Dim i As Integer Dim Encoders() As ImageCodecInfo = ImageCodecInfo.GetImageEncoders() For i = 0 To Encoders.Length - 1 If Encoders(i).MimeType = mimeType Then Return Encoders(i) End If Next Return Nothing End Function Public Sub main() Dim codecInfo As ImageCodecInfo = GetEncoderInfo("image/jpeg") Dim enc As Encoder = Encoder.Quality Dim EncParams As New EncoderParameters(1) Dim Dir As New DirectoryInfo(Directory.GetCurrentDirectory()) Dim image As Image = image.FromFile("C:\Documents and Settings\My Documents\Visual Studio Projects\VbNet\project\Image Compression\bin\supra_1.bmp") Dim jpgName As String EncParams.Param(0) = New EncoderParameter(enc, 25L) jpgName = Path.GetFileNameWithoutExtension("C:\Documents and Settings\My Documents\Visual Studio Projects\VbNet\project\Image Compression\bin\supra_1.bmp") & "0" & ".bmp" image.Save(jpgName, codecInfo, EncParams) End Sub End Module hth. regards Peter Proost wrote: Show quoteHide quote >Hi group, I've got a question about the size of a saved bitmap. >What I need to do is open a bitmap if it needs resizing, resize and save it. >This isn't a problem, but the problem I have is that the original image has >got an 8 bit indexed pixelformat, >but you can't create a graphics object for this pixelformat so my bitmap >uses the default pixelformat: >Format32bppArgb, but this ofcourse result in a much larger file size (420kB >instead of 106kB) >I know I can use for example Format24bppRgb and this reduces the size to >300kB but I would like to know if I there's a way I can keep the size at >106kB > >Thanks in advance > >Greetz Peter > > > > Hi supra, thanks for your answer, it works but in some picture programms it
gives a warning because it's actualy a jpeg image with a bmp extension Greetz Peter -- Show quoteHide quoteProgramming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. "Supra" <supra@domain.invalid> schreef in bericht news:4fSdnT2hhPhuQ1XfRVn-iw@rogers.com... > i proost, > i created compressed bmp. there is not control to be added. > > Option Explicit On > Option Strict Off > Imports System.Drawing.Imaging > Imports System.IO > Module ImageCompression > > Private Function GetEncoderInfo(ByVal mimeType As String) As > ImageCodecInfo > Dim i As Integer > Dim Encoders() As ImageCodecInfo = ImageCodecInfo.GetImageEncoders() > For i = 0 To Encoders.Length - 1 > If Encoders(i).MimeType = mimeType Then > Return Encoders(i) > End If > Next > Return Nothing > End Function > > Public Sub main() > Dim codecInfo As ImageCodecInfo = GetEncoderInfo("image/jpeg") > Dim enc As Encoder = Encoder.Quality > Dim EncParams As New EncoderParameters(1) > Dim Dir As New DirectoryInfo(Directory.GetCurrentDirectory()) > Dim image As Image = image.FromFile("C:\Documents and > Settings\My Documents\Visual Studio Projects\VbNet\project\Image > Compression\bin\supra_1.bmp") > Dim jpgName As String > EncParams.Param(0) = New EncoderParameter(enc, 25L) > jpgName = Path.GetFileNameWithoutExtension("C:\Documents and > Settings\My Documents\Visual Studio Projects\VbNet\project\Image > Compression\bin\supra_1.bmp") & "0" & ".bmp" > image.Save(jpgName, codecInfo, EncParams) > End Sub > End Module > > hth. > regards > > Peter Proost wrote: > > >Hi group, I've got a question about the size of a saved bitmap. > >What I need to do is open a bitmap if it needs resizing, resize and save it. > >This isn't a problem, but the problem I have is that the original image has > >got an 8 bit indexed pixelformat, > >but you can't create a graphics object for this pixelformat so my bitmap > >uses the default pixelformat: > >Format32bppArgb, but this ofcourse result in a much larger file size (420kB > >instead of 106kB) > >I know I can use for example Format24bppRgb and this reduces the size to > >300kB but I would like to know if I there's a way I can keep the size at > >106kB > > > >Thanks in advance > > > >Greetz Peter > > > > > > > > u can change extenison u want.ico, jpg or bmp etc
Peter Proost wrote: Show quoteHide quote >Hi supra, thanks for your answer, it works but in some picture programms it >gives a warning because it's actualy a jpeg image with a bmp extension > >Greetz Peter > >-- >Programming today is a race between software engineers striving to build >bigger and better idiot-proof programs, and the Universe trying to produce >bigger and better idiots. So far, the Universe is winning. > >"Supra" <supra@domain.invalid> schreef in bericht >news:4fSdnT2hhPhuQ1XfRVn-iw@rogers.com... > > >>i proost, >>i created compressed bmp. there is not control to be added. >> >>Option Explicit On >>Option Strict Off >>Imports System.Drawing.Imaging >>Imports System.IO >>Module ImageCompression >> >> Private Function GetEncoderInfo(ByVal mimeType As String) As >>ImageCodecInfo >> Dim i As Integer >> Dim Encoders() As ImageCodecInfo = >> >> >ImageCodecInfo.GetImageEncoders() > > >> For i = 0 To Encoders.Length - 1 >> If Encoders(i).MimeType = mimeType Then >> Return Encoders(i) >> End If >> Next >> Return Nothing >> End Function >> >> Public Sub main() >> Dim codecInfo As ImageCodecInfo = GetEncoderInfo("image/jpeg") >> Dim enc As Encoder = Encoder.Quality >> Dim EncParams As New EncoderParameters(1) >> Dim Dir As New DirectoryInfo(Directory.GetCurrentDirectory()) >> Dim image As Image = image.FromFile("C:\Documents and >>Settings\My Documents\Visual Studio Projects\VbNet\project\Image >>Compression\bin\supra_1.bmp") >> Dim jpgName As String >> EncParams.Param(0) = New EncoderParameter(enc, 25L) >> jpgName = Path.GetFileNameWithoutExtension("C:\Documents and >>Settings\My Documents\Visual Studio Projects\VbNet\project\Image >>Compression\bin\supra_1.bmp") & "0" & ".bmp" >> image.Save(jpgName, codecInfo, EncParams) >> End Sub >>End Module >> >>hth. >>regards >> >>Peter Proost wrote: >> >> >> >>>Hi group, I've got a question about the size of a saved bitmap. >>>What I need to do is open a bitmap if it needs resizing, resize and save >>> >>> >it. > > >>>This isn't a problem, but the problem I have is that the original image >>> >>> >has > > >>>got an 8 bit indexed pixelformat, >>>but you can't create a graphics object for this pixelformat so my bitmap >>>uses the default pixelformat: >>>Format32bppArgb, but this ofcourse result in a much larger file size >>> >>> >(420kB > > >>>instead of 106kB) >>>I know I can use for example Format24bppRgb and this reduces the size to >>>300kB but I would like to know if I there's a way I can keep the size at >>>106kB >>> >>>Thanks in advance >>> >>>Greetz Peter >>> >>> >>> >>> >>> >>> > > > > I know, but I need .bmp file :-)
Greetz Peter -- Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. "Supra" <supra@domain.invalid> schreef in bericht news:HaednUbjN5C7pVTfRVn-3g@rogers.com... u can change extenison u want.ico, jpg or bmp etcPeter Proost wrote: Hi supra, thanks for your answer, it works but in some picture programms it gives a warning because it's actualy a jpeg image with a bmp extension Greetz Peter -- Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. "Supra" <supra@domain.invalid> schreef in bericht i proost,news:4fSdnT2hhPhuQ1XfRVn-iw@rogers.com... i created compressed bmp. there is not control to be added. Option Explicit On Option Strict Off Imports System.Drawing.Imaging Imports System.IO Module ImageCompression Private Function GetEncoderInfo(ByVal mimeType As String) As ImageCodecInfo Dim i As Integer Dim Encoders() As ImageCodecInfo = ImageCodecInfo.GetImageEncoders() For i = 0 To Encoders.Length - 1 If Encoders(i).MimeType = mimeType Then Return Encoders(i) End If Next Return Nothing End Function Public Sub main() Dim codecInfo As ImageCodecInfo = GetEncoderInfo("image/jpeg") Dim enc As Encoder = Encoder.Quality Dim EncParams As New EncoderParameters(1) Dim Dir As New DirectoryInfo(Directory.GetCurrentDirectory()) Dim image As Image = image.FromFile("C:\Documents and Settings\My Documents\Visual Studio Projects\VbNet\project\Image Compression\bin\supra_1.bmp") Dim jpgName As String EncParams.Param(0) = New EncoderParameter(enc, 25L) jpgName = Path.GetFileNameWithoutExtension("C:\Documents and Settings\My Documents\Visual Studio Projects\VbNet\project\Image Compression\bin\supra_1.bmp") & "0" & ".bmp" image.Save(jpgName, codecInfo, EncParams) End Sub End Module hth. regards Peter Proost wrote: Hi group, I've got a question about the size of a saved bitmap. What I need to do is open a bitmap if it needs resizing, resize and save it. This isn't a problem, but the problem I have is that the original image has got an 8 bit indexed pixelformat, but you can't create a graphics object for this pixelformat so my bitmap uses the default pixelformat: Format32bppArgb, but this ofcourse result in a much larger file size (420kB instead of 106kB) I know I can use for example Format24bppRgb and this reduces the size to 300kB but I would like to know if I there's a way I can keep the size at 106kB Thanks in advance Greetz Peter rephrase it "but I need .bmp file" ..what do u mean....u can't find file?
regards Peter Proost wrote: Show quoteHide quote > I know, but I need .bmp file :-) > > Greetz Peter > > -- > Programming today is a race between software engineers striving to > build bigger and better idiot-proof programs, and the Universe trying > to produce bigger and better idiots. So far, the Universe is winning. > > "Supra" <supra@domain.invalid <mailto:supra@domain.invalid>> > schreef in bericht news:HaednUbjN5C7pVTfRVn-3g@rogers.com... > u can change extenison u want.ico, jpg or bmp etc > > Peter Proost wrote: > >>Hi supra, thanks for your answer, it works but in some picture programms it >>gives a warning because it's actualy a jpeg image with a bmp extension >> >>Greetz Peter >> >>-- >>Programming today is a race between software engineers striving to build >>bigger and better idiot-proof programs, and the Universe trying to produce >>bigger and better idiots. So far, the Universe is winning. >> >>"Supra" <supra@domain.invalid> schreef in bericht >>news:4fSdnT2hhPhuQ1XfRVn-iw@rogers.com... >> >> >>>i proost, >>>i created compressed bmp. there is not control to be added. >>> >>>Option Explicit On >>>Option Strict Off >>>Imports System.Drawing.Imaging >>>Imports System.IO >>>Module ImageCompression >>> >>> Private Function GetEncoderInfo(ByVal mimeType As String) As >>>ImageCodecInfo >>> Dim i As Integer >>> Dim Encoders() As ImageCodecInfo = >>> >>> >>ImageCodecInfo.GetImageEncoders() >> >> >>> For i = 0 To Encoders.Length - 1 >>> If Encoders(i).MimeType = mimeType Then >>> Return Encoders(i) >>> End If >>> Next >>> Return Nothing >>> End Function >>> >>> Public Sub main() >>> Dim codecInfo As ImageCodecInfo = GetEncoderInfo("image/jpeg") >>> Dim enc As Encoder = Encoder.Quality >>> Dim EncParams As New EncoderParameters(1) >>> Dim Dir As New DirectoryInfo(Directory.GetCurrentDirectory()) >>> Dim image As Image = image.FromFile("C:\Documents and >>>Settings\My Documents\Visual Studio Projects\VbNet\project\Image >>>Compression\bin\supra_1.bmp") >>> Dim jpgName As String >>> EncParams.Param(0) = New EncoderParameter(enc, 25L) >>> jpgName = Path.GetFileNameWithoutExtension("C:\Documents and >>>Settings\My Documents\Visual Studio Projects\VbNet\project\Image >>>Compression\bin\supra_1.bmp") & "0" & ".bmp" >>> image.Save(jpgName, codecInfo, EncParams) >>> End Sub >>>End Module >>> >>>hth. >>>regards >>> >>>Peter Proost wrote: >>> >>> >>> >>>>Hi group, I've got a question about the size of a saved bitmap. >>>>What I need to do is open a bitmap if it needs resizing, resize and save >>>> >>>> >>it. >> >> >>>>This isn't a problem, but the problem I have is that the original image >>>> >>>> >>has >> >> >>>>got an 8 bit indexed pixelformat, >>>>but you can't create a graphics object for this pixelformat so my bitmap >>>>uses the default pixelformat: >>>>Format32bppArgb, but this ofcourse result in a much larger file size >>>> >>>> >>(420kB >> >> >>>>instead of 106kB) >>>>I know I can use for example Format24bppRgb and this reduces the size to >>>>300kB but I would like to know if I there's a way I can keep the size at >>>>106kB >>>> >>>>Thanks in advance >>>> >>>>Greetz Peter >>>> >>>> >>>> >>>> >>>> >>>> >> >> >> >> I mean I need to save it as .bmp file, and with your encoder parameters it becomes a jpeg but with a .bmp extension and some imaging programms have problems with this
Greetz Peter -- Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. "Supra" <supra@domain.invalid> schreef in bericht news:sKSdnZoNxdty1FTfRVn-qg@rogers.com... rephrase it "but I need .bmp file" ..what do u mean....u can't find file?regards Peter Proost wrote: I know, but I need .bmp file :-) Greetz Peter -- Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. "Supra" <supra@domain.invalid> schreef in bericht news:HaednUbjN5C7pVTfRVn-3g@rogers.com... u can change extenison u want.ico, jpg or bmp etcPeter Proost wrote: Hi supra, thanks for your answer, it works but in some picture programms it gives a warning because it's actualy a jpeg image with a bmp extension Greetz Peter -- Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. "Supra" <supra@domain.invalid> schreef in bericht i proost,news:4fSdnT2hhPhuQ1XfRVn-iw@rogers.com... i created compressed bmp. there is not control to be added. Option Explicit On Option Strict Off Imports System.Drawing.Imaging Imports System.IO Module ImageCompression Private Function GetEncoderInfo(ByVal mimeType As String) As ImageCodecInfo Dim i As Integer Dim Encoders() As ImageCodecInfo = ImageCodecInfo.GetImageEncoders() For i = 0 To Encoders.Length - 1 If Encoders(i).MimeType = mimeType Then Return Encoders(i) End If Next Return Nothing End Function Public Sub main() Dim codecInfo As ImageCodecInfo = GetEncoderInfo("image/jpeg") Dim enc As Encoder = Encoder.Quality Dim EncParams As New EncoderParameters(1) Dim Dir As New DirectoryInfo(Directory.GetCurrentDirectory()) Dim image As Image = image.FromFile("C:\Documents and Settings\My Documents\Visual Studio Projects\VbNet\project\Image Compression\bin\supra_1.bmp") Dim jpgName As String EncParams.Param(0) = New EncoderParameter(enc, 25L) jpgName = Path.GetFileNameWithoutExtension("C:\Documents and Settings\My Documents\Visual Studio Projects\VbNet\project\Image Compression\bin\supra_1.bmp") & "0" & ".bmp" image.Save(jpgName, codecInfo, EncParams) End Sub End Module hth. regards Peter Proost wrote: Hi group, I've got a question about the size of a saved bitmap. What I need to do is open a bitmap if it needs resizing, resize and save it. This isn't a problem, but the problem I have is that the original image has got an 8 bit indexed pixelformat, but you can't create a graphics object for this pixelformat so my bitmap uses the default pixelformat: Format32bppArgb, but this ofcourse result in a much larger file size (420kB instead of 106kB) I know I can use for example Format24bppRgb and this reduces the size to 300kB but I would like to know if I there's a way I can keep the size at 106kB Thanks in advance Greetz Peter i did test my owned bmp and the file size is 3.6 mb and downsizing to
67kb and i saved as supra.bmp. i don't know if this website could help u. http://www.devx.com/dotnet/Article/18163/0/page/3 regards Peter Proost wrote: Show quoteHide quote > I mean I need to save it as .bmp file, and with your encoder > parameters it becomes a jpeg but with a .bmp extension and some > imaging programms have problems with this > > Greetz Peter > > -- > Programming today is a race between software engineers striving to > build bigger and better idiot-proof programs, and the Universe trying > to produce bigger and better idiots. So far, the Universe is winning. > > "Supra" <supra@domain.invalid <mailto:supra@domain.invalid>> > schreef in bericht news:sKSdnZoNxdty1FTfRVn-qg@rogers.com... > rephrase it "but I need .bmp file" ..what do u mean....u can't > find file? > regards > > Peter Proost wrote: > >> I know, but I need .bmp file :-) >> >> Greetz Peter >> >> -- >> Programming today is a race between software engineers striving >> to build bigger and better idiot-proof programs, and the Universe >> trying to produce bigger and better idiots. So far, the Universe >> is winning. >> >> "Supra" <supra@domain.invalid <mailto:supra@domain.invalid>> >> schreef in bericht news:HaednUbjN5C7pVTfRVn-3g@rogers.com... >> u can change extenison u want.ico, jpg or bmp etc >> >> Peter Proost wrote: >> >>>Hi supra, thanks for your answer, it works but in some picture programms it >>>gives a warning because it's actualy a jpeg image with a bmp extension >>> >>>Greetz Peter >>> >>>-- >>>Programming today is a race between software engineers striving to build >>>bigger and better idiot-proof programs, and the Universe trying to produce >>>bigger and better idiots. So far, the Universe is winning. >>> >>>"Supra" <supra@domain.invalid> schreef in bericht >>>news:4fSdnT2hhPhuQ1XfRVn-iw@rogers.com... >>> >>> >>>>i proost, >>>>i created compressed bmp. there is not control to be added. >>>> >>>>Option Explicit On >>>>Option Strict Off >>>>Imports System.Drawing.Imaging >>>>Imports System.IO >>>>Module ImageCompression >>>> >>>> Private Function GetEncoderInfo(ByVal mimeType As String) As >>>>ImageCodecInfo >>>> Dim i As Integer >>>> Dim Encoders() As ImageCodecInfo = >>>> >>>> >>>ImageCodecInfo.GetImageEncoders() >>> >>> >>>> For i = 0 To Encoders.Length - 1 >>>> If Encoders(i).MimeType = mimeType Then >>>> Return Encoders(i) >>>> End If >>>> Next >>>> Return Nothing >>>> End Function >>>> >>>> Public Sub main() >>>> Dim codecInfo As ImageCodecInfo = GetEncoderInfo("image/jpeg") >>>> Dim enc As Encoder = Encoder.Quality >>>> Dim EncParams As New EncoderParameters(1) >>>> Dim Dir As New DirectoryInfo(Directory.GetCurrentDirectory()) >>>> Dim image As Image = image.FromFile("C:\Documents and >>>>Settings\My Documents\Visual Studio Projects\VbNet\project\Image >>>>Compression\bin\supra_1.bmp") >>>> Dim jpgName As String >>>> EncParams.Param(0) = New EncoderParameter(enc, 25L) >>>> jpgName = Path.GetFileNameWithoutExtension("C:\Documents and >>>>Settings\My Documents\Visual Studio Projects\VbNet\project\Image >>>>Compression\bin\supra_1.bmp") & "0" & ".bmp" >>>> image.Save(jpgName, codecInfo, EncParams) >>>> End Sub >>>>End Module >>>> >>>>hth. >>>>regards >>>> >>>>Peter Proost wrote: >>>> >>>> >>>> >>>>>Hi group, I've got a question about the size of a saved bitmap. >>>>>What I need to do is open a bitmap if it needs resizing, resize and save >>>>> >>>>> >>>it. >>> >>> >>>>>This isn't a problem, but the problem I have is that the original image >>>>> >>>>> >>>has >>> >>> >>>>>got an 8 bit indexed pixelformat, >>>>>but you can't create a graphics object for this pixelformat so my bitmap >>>>>uses the default pixelformat: >>>>>Format32bppArgb, but this ofcourse result in a much larger file size >>>>> >>>>> >>>(420kB >>> >>> >>>>>instead of 106kB) >>>>>I know I can use for example Format24bppRgb and this reduces the size to >>>>>300kB but I would like to know if I there's a way I can keep the size at >>>>>106kB >>>>> >>>>>Thanks in advance >>>>> >>>>>Greetz Peter >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>> >>> >>> >>> Thanks for the link supra, it's helpfull but I think Larry is right, that I'm a bit stuck for the 8 bit indexed pixel format, but it isn't a big disaster, only bigger images :-)
Thanks and Greetz Peter -- Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. "Supra" <supra@domain.invalid> schreef in bericht news:lP6dndVVoraQ_FTfRVn-hw@rogers.com... i did test my owned bmp and the file size is 3.6 mb and downsizing to 67kb and i saved as supra.bmp. i don't know if this website could help u. http://www.devx.com/dotnet/Article/18163/0/page/3 regards Peter Proost wrote: I mean I need to save it as .bmp file, and with your encoder parameters it becomes a jpeg but with a .bmp extension and some imaging programms have problems with this Greetz Peter -- Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. "Supra" <supra@domain.invalid> schreef in bericht news:sKSdnZoNxdty1FTfRVn-qg@rogers.com... rephrase it "but I need .bmp file" ..what do u mean....u can't find file?regards Peter Proost wrote: I know, but I need .bmp file :-) Greetz Peter -- Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. "Supra" <supra@domain.invalid> schreef in bericht news:HaednUbjN5C7pVTfRVn-3g@rogers.com... u can change extenison u want.ico, jpg or bmp etcPeter Proost wrote: Hi supra, thanks for your answer, it works but in some picture programms it gives a warning because it's actualy a jpeg image with a bmp extension Greetz Peter -- Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. "Supra" <supra@domain.invalid> schreef in bericht i proost,news:4fSdnT2hhPhuQ1XfRVn-iw@rogers.com... i created compressed bmp. there is not control to be added. Option Explicit On Option Strict Off Imports System.Drawing.Imaging Imports System.IO Module ImageCompression Private Function GetEncoderInfo(ByVal mimeType As String) As ImageCodecInfo Dim i As Integer Dim Encoders() As ImageCodecInfo = ImageCodecInfo.GetImageEncoders() For i = 0 To Encoders.Length - 1 If Encoders(i).MimeType = mimeType Then Return Encoders(i) End If Next Return Nothing End Function Public Sub main() Dim codecInfo As ImageCodecInfo = GetEncoderInfo("image/jpeg") Dim enc As Encoder = Encoder.Quality Dim EncParams As New EncoderParameters(1) Dim Dir As New DirectoryInfo(Directory.GetCurrentDirectory()) Dim image As Image = image.FromFile("C:\Documents and Settings\My Documents\Visual Studio Projects\VbNet\project\Image Compression\bin\supra_1.bmp") Dim jpgName As String EncParams.Param(0) = New EncoderParameter(enc, 25L) jpgName = Path.GetFileNameWithoutExtension("C:\Documents and Settings\My Documents\Visual Studio Projects\VbNet\project\Image Compression\bin\supra_1.bmp") & "0" & ".bmp" image.Save(jpgName, codecInfo, EncParams) End Sub End Module hth. regards Peter Proost wrote: Hi group, I've got a question about the size of a saved bitmap. What I need to do is open a bitmap if it needs resizing, resize and save it. This isn't a problem, but the problem I have is that the original image has got an 8 bit indexed pixelformat, but you can't create a graphics object for this pixelformat so my bitmap uses the default pixelformat: Format32bppArgb, but this ofcourse result in a much larger file size (420kB instead of 106kB) I know I can use for example Format24bppRgb and this reduces the size to 300kB but I would like to know if I there's a way I can keep the size at 106kB Thanks in advance Greetz Peter Peter Proost wrote:
> Hi group, I've got a question about the size of a saved bitmap. I've had a little look around, and basically I think you're stuck :(> What I need to do is open a bitmap if it needs resizing, resize and save it. > This isn't a problem, but the problem I have is that the original image has > got an 8 bit indexed pixelformat, > but you can't create a graphics object for this pixelformat so my bitmap > uses the default pixelformat: > Format32bppArgb, but this ofcourse result in a much larger file size (420kB > instead of 106kB) > I know I can use for example Format24bppRgb and this reduces the size to > 300kB but I would like to know if I there's a way I can keep the size at > 106kB At present it seems GDI+ just *doesn't do* indexed bitmaps, even the estimable Bob Powell GDI+ FAQ site has to skirt round these. So if you want to create or update these, I think your choice is either wait for a newer version of the framework (and I'm not sure 2.0 is going to do these), or: Go down to the bits and bytes yourself... which probably wants to be done in C# in unsafe code for performance, which - if it sounds like your thing - is probably great fun, but not something I would like to try myself... -- Larry Lard Replies to group please
How to convert error code to text??
Send datagrid via email Need Help With Translation C#? to VB How to convert this code from C# to VB.NET? Change Value of Existing Element How To? import vb net forms ??? MessageBox coming up with blank message and blank buttons. Monitor process creation Design Question how pass data between forms |
|||||||||||||||||||||||