how change jpg to bmp lazarus / 9-Editor ---------------------------------------------------------------------- skaner1900 · 2010-07-25 23:14 i try do it by this code: Code: [Select]procedure TForm1.Button1Click(Sender: TObject); var  JPG:TJpegImage;  BMP:TBitmap; begin   JPG:=TJpegImage.Create;   BMP:=TBitmap.Create;   JPG.LoadFromFile('C:\abc.jpg');   BMP.Assign(jpg);   BMP.SaveToFile('C:\abc.bmp');   BMP.Free;   JPG.Free; end; but Bitmap in Lazarus haven't functions like: Create, LoadFromFile, SaveToFile, and Assign... how change jpg file to bmp? ---------------------------------------------------------------------- Leledumbo · 2010-07-26 07:50 Use TPicture instead ---------------------------------------------------------------------- Marc · 2010-07-26 22:25 Quote from: Leledumbo on July 26, 2010, 09:50:26 amUse TPicture instead IIRC, You cannot use a tpicture for that. When you change the graphic class, the internal image is destroyed. ---------------------------------------------------------------------- Leledumbo · 2010-07-27 04:43 QuoteIIRC, You cannot use a tpicture for that. When you change the graphic class, the internal image is destroyed.Hmm... I remember ever create file converter using TPicture.LoadFromFile() and TPicture.SaveToFile() (or was it TImage?). ---------------------------------------------------------------------- Marc · 2010-07-27 12:42 Afaik the old graphic system could save a image of one type into another, but it only resulted in a different extension. No conversion was done (thats the reason why you nowadays only can load a bitmap into a TBitmap) otoh, I can't remember if TImage/Tpicture does some conversion based on file extension. I only do know that if you assign a jpeg to a TPicture and you access TPicture.AsBitmap, the class is converted, but not the data. (thinking of, implementing such feature isn't to difficult) ---------------------------------------------------------------------- Leledumbo · 2010-07-28 09:06 QuoteI can't remember if TImage/Tpicture does some conversion based on file extensionI'll check out my project that uses this, AFAIR the SaveToFile method doesn't only accept filename, but a class reference as well. ---------------------------------------------------------------------- theo · 2010-07-28 09:17 This works here: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i var aPic:TP icture;beginaPic:=TPicture.Create;aPic.LoadFromFile('a.jpg');aPic.Save ToFile('a.bmp');aPic.free;end; ---------------------------------------------------------------------- Leledumbo · 2010-07-28 09:52 Can you clarify that the contents resemble the extension? ---------------------------------------------------------------------- theo · 2010-07-28 10:24 Quote from: Leledumbo on July 28, 2010, 11:52:26 amCan you clarify that the contents resemble the extension? Sure: JFIF <> BM ---------------------------------------------------------------------- Leledumbo · 2010-07-28 10:39 OK, so what I said was right ---------------------------------------------------------------------- skaner1900 · 2010-07-28 17:02 how change gif, tiff, png? all to bmp, without components ---------------------------------------------------------------------- Leledumbo · 2010-07-29 03:32 Just do as theo post (but I'm afraid it doesn't have tiff support yet, though we already have working writer and reader in fcl-image, just a matter of time I guess), TPicture isn't a visual component. ---------------------------------------------------------------------- marcov · 2010-07-29 10:13 Have a look at the imgconv demo of fcl-image (packages/fcl- image/examples in FPC svn) The cmdline is a bit complex, but it works. ---------------------------------------------------------------------- Marc · 2010-08-03 16:32 svn version of lazarus has a TTiffImage ---------------------------------------------------------------------- Leledumbo · 2010-08-04 07:38 Glad to hear that Has it been incorporated to TPicture as well? ---------------------------------------------------------------------- Marc · 2010-08-04 21:59 afaik yes ---------------------------------------------------------------------- felipemdc · 2010-08-05 19:24 The puzzling thing about the original post is that not only TBitmap has the methods Create, LoadFromFile, SaveToFile and Assign, but also that the original code should already work, or at least similar code always works for me. ---------------------------------------------------------------------- Marc · 2010-08-05 22:38 True, maybe he uses ... Graphics, LCLType ... instead of LCLType, Graphics So he gets LCLType.TBitmap instead of Graphics.TBitmap