Bitmap Cutters & Bitmap Clippers

Source: Internet
Author: User

Bitmap Cutters:

    Although there are similar tools on the Web, PhotoShop has similar features, but the former does not seem to support oversized bitmap cutting (in G-size), and the latter's number of cutting blocks seems to have a relatively small limit, so he wrote this tool.

As for why the "bitmap" cutter, the reason is that I really do not want to bother to parse such as JPG, PNG, TGA and other image formats, and we all know that parsing BMP file is relatively simple.

Core processing code is very simple, no outside of ReadFile, SetFilePointer, such as API calls.

functionHandlesplit (ConstFileName, Dstpath, Imgname:string; UNITW, Unith:integer): Boolean;varHandle:integer;  Fileheader:tbitmapfileheader;  Bmpinfoheader:tbitmapinfoheader;  Offset:integer;  Mem, Dstmem:tmemorystream;  Linelen:integer;  Perbits:integer;  I, J, W, H:integer; X, Y:string; procedureReadareaimgdata (L, T, W, H:integer;  Dst:pbyte); varN:integer;  Len:integer; beginLen:= W *perbits;  forN: = T toT + H-1  Do    beginFileSeek (Handle, Offset+ Linelen * N + L * perbits,0);      FileRead (Handle, dst^, Len);    INC (Dst, Len); End; End;beginResult:=False; Handle:= FileOpen (FileName, Fmopenreadorfmsharedenywrite); ifHandle <0  ThenExit; Try    ifFileRead (Handle, Fileheader, sizeof (fileheader)) <> sizeof (Fileheader) ThenExit; ifFileheader.bftype <> $4d42 ThenExit; ifFileRead (Handle, bmpInfoHeader, sizeof (bmpinfoheader)) <> sizeof (bmpInfoHeader) ThenExit;  CaseBmpinfoheader.bibitcount of       -:        beginperbits:=2; End;  -:        beginperbits:=3; End;  +:        beginperbits:=4; End    ElseExit; End; Offset:= SizeOf (Fileheader) +SizeOf (bmpInfoHeader); Linelen:= (Bmpinfoheader.biwidth * perbits +3)Div 4*4; Mem:=tmemorystream.create; Dstmem:=tmemorystream.create; W:= Bmpinfoheader.biwidthDivUNITW; H:= Bmpinfoheader.biheightDivUnith;  forJ: =0  toH1  Do    begin       forI: =0  toW1  Do      beginX:= Format ('%.3d', [I]); Y:= Format ('%.3d', [H-1-J]);        Mem.clear; Mem.setsize (UNITW* Perbits *Unith); Mem.position:=0; Readareaimgdata (I* UNITW, J *Unith, UNITW, Unith, mem.memory);        Dstmem.clear;        Dstmem.write (Fileheader, SizeOf (Fileheader)); Bmpinfoheader.biwidth:=UNITW; Bmpinfoheader.biheight:=Unith; Bmpinfoheader.bisizeimage:=0;        Dstmem.write (bmpInfoHeader, SizeOf (bmpInfoHeader));            Dstmem.write (mem.memory^, mem.size); Dstmem.savetofile (Imgname+'_'+ Y +'_'+ X +'. bmp'); End; End;    Freeandnil (MEM);    Freeandnil (DSTMEM); Result:=True; finallyFileClose (Handle); End;End;

The tool download link is here.

Bitmap Clipper: This program is written because it is not easy to find a convenient image capture tool, especially when the need to precisely cut large pictures-here the "larger", and the above cutter is not the same, it is unlikely to be able to cut the size of the G-sized bitmap-this tool was written earlier, did not consider supporting the super-large picture, There is no intention to improve it now.

The download link for this tool is here.

Bitmap Cutters & Bitmap Clippers

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.