{"id":156,"date":"2007-05-12T16:20:31","date_gmt":"2007-05-12T14:20:31","guid":{"rendered":" http:\/\/www.nsonic.de\/blog\/2007\/05\/bitmaps-accessing-big-images\/"},"modified":"2007-05-12T16:20:34","modified_gmt":"2007-05-12T14:20:34","slug":"bitmaps-accessing-big-images","status":"publish","type":"post","link":"https:\/\/www.nsonic.de\/blog\/2007\/05\/bitmaps-accessing-big-images\/","title":{"rendered":"Bitmaps: Accessing Big Images"},"content":{"rendered":"<p>Luis Antonio  wrote in message<br \/>\nnews:7ksu6u$<br \/>\nc3l14@forums.borland.com&#8230; <\/p>\n<p><em>> Hello:<br \/>\n><br \/>\n>         I&#8217;m making a cartographic program that use an TImage with an<br \/>\n> cartographic map image in jpeg format as background. This map is inside a<br \/>\n> scrollbox because is 3500 x 906 pixels (900 Kb) or 6890 x 1790 (3819 Kb).<br \/>\nBy<br \/>\n> its quality the second is preferable.<br \/>\n><br \/>\n>         The user will be able to move the map arround, will be able to<br \/>\nmake<br \/>\n> searches  and will be able to move the mouse over the cities and to know<br \/>\n> information about them. By these reasons the program will have to be<br \/>\nfaster<br \/>\n> and agile.<br \/>\n><br \/>\n>         Could somebody advise some component to me better than TImage?<br \/>\nSome<br \/>\n> other advise?<br \/>\n><br \/>\n> Thanks in advance:<br \/>\n><br \/>\n> &#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br \/>\n> Luis Antonio<br \/>\n><br \/>\n<\/em><br \/>\nHi. I have the same problem with images that use 15Mg, you need to make a<br \/>\nprogram that cut the jpeg in (for example) 6&#215;10 jpeg files.<br \/>\nThen READ ALL the new jpegs. The diferent is that the pc will need less<br \/>\nmemory to descompress the images, and it will be very faster.<br \/>\n<!--more--><br \/>\nWhen i do this i pass, from 60 seconds to load the bigimage, to 4 seconds.<br \/>\nYou need to test in how many parts cut it.<\/p>\n<p>use a code like this:<\/p>\n<p>[code lang=&#8221;delphi&#8221;]function<br \/>\nconst<br \/>\n cx=3;<br \/>\n  cy=6;<br \/>\nvar<br \/>\n  xx,yy,ax,ay,n,p:integer;<br \/>\n  j:tjpegimage;<br \/>\n  b,bs:tbitmap;<br \/>\nbegin<br \/>\n dt:=now;<br \/>\n  j:=tjpegimage.create;<br \/>\n  b:=tbitmap.create;<br \/>\n  bs:=tbitmap.create;<br \/>\n  for n:=1 to 20 do<br \/>\n    begin<br \/>\n      j.LoadFromFile();<br \/>\n      b.assign(j); {you need to assign it to a bitmap, so you can work on<br \/>\nit}<br \/>\n      xx:=b.width div cx;<br \/>\n      yy:=b.height div cy;<br \/>\n      bs.width:=xx; bs.height:=yy;<br \/>\n      for ax:=0 to cx-1 do<br \/>\n       for ay:=0 to cy-1 do<br \/>\n        begin<br \/>\n        bs.canvas.draw(-xx*ax,-yy*ay,b);<br \/>\n          j.Assign(bs);<\/p>\n<p>j.savetofile(&#8216;c:\\sal\\n&#8217;+inttostr(n)+&#8217;p&#8217;+inttostr(p)+&#8217;p&#8217;+inttostr(ay)+&#8217;.&#8217;+int<br \/>\ntostr(ax));<br \/>\n        end;<br \/>\n    end;<br \/>\n  b.free;<br \/>\n  bs.free;<br \/>\n  j.free;<br \/>\nend;<br \/>\n[\/code]<br \/>\nIf it&#8217;s slowly, you can only read the parts that the user is seeing, plus<br \/>\nthe corners.<\/p>\n<p>[tags]Delphi, Graphic[\/tags]<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Luis Antonio wrote in message news:7ksu6u$ c3l14@forums.borland.com&#8230; > Hello: > > I&#8217;m making a cartographic program that use an TImage with an >&hellip;<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"spay_email":""},"categories":[11],"tags":[75,101],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p71Tml-2w","_links":{"self":[{"href":"https:\/\/www.nsonic.de\/blog\/wp-json\/wp\/v2\/posts\/156"}],"collection":[{"href":"https:\/\/www.nsonic.de\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.nsonic.de\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.nsonic.de\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.nsonic.de\/blog\/wp-json\/wp\/v2\/comments?post=156"}],"version-history":[{"count":0,"href":"https:\/\/www.nsonic.de\/blog\/wp-json\/wp\/v2\/posts\/156\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.nsonic.de\/blog\/wp-json\/wp\/v2\/media?parent=156"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.nsonic.de\/blog\/wp-json\/wp\/v2\/categories?post=156"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.nsonic.de\/blog\/wp-json\/wp\/v2\/tags?post=156"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}