Methods for importing large TIFF images into AutoCAD

By obtaining the intersection range of TIFF images and AutoCAD viewports, and dynamically loading super-large TIFF images using the GDAL library, the problem of excessively large images being unable to import AutoCAD is solved, and an efficient and automated image import method is realized.

CN115439310BActive Publication Date: 2025-08-08POWER CHINA KUNMING ENG CORP LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211022767.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-08-25
Publication Date
2025-08-08
Estimated Expiration
2042-08-25

AI Technical Summary

Technical Problem

The existing image loading method cannot process TIFF images with too large volume, resulting in the inability to import them into AutoCAD software for design reference.

Method used

By obtaining the pixel size and plane coordinate range of the TIFF image, as well as the range of the current viewport of AutoCAD, we judge the intersection, and use the GDAL library to read the image data of the intersection range to dynamically load the super-large TIFF image.

Benefits of technology

Real-time dynamic loading of super-large TIFF images in AutoCAD is realized, which improves the degree of automation and loading efficiency and meets design needs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115439310B_ABST
    Figure CN115439310B_ABST
Patent Text Reader

Abstract

A method for importing very large TIFF images into AutoCAD belongs to the field of image data processing and application technology, and specifically provides a method for importing very large TIFF images into AutoCAD. The method obtains the pixel size and plane coordinate range of the TIFF image, as well as the range in the AutoCAD current viewport's plane projection coordinate system and the size of the current window, determines the intersection of the window ranges, and then uses a plug-in to import the image portion into the AutoCAD software, thereby dynamically importing very large TIFF images into AutoCAD. The method has a rational design and is characterized by a high degree of automation, high efficiency, good accuracy, and low cost.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention belongs to the technical field of image data processing and application, and in particular is a method for importing an ultra-large TIFF image into AutoCAD. Background Art

[0002] In the design of roads, bridges, etc., it is usually necessary to import orthophotos into AutoCAD design software as a reference base map, and then perform design work based on the base map data.

[0003] The existing image loading method mainly uses a plug-in to import the entire image into the AutoCAD software, but it cannot process images that are too large. In response to this situation, the present invention proposes a method for loading large-volume images in real time. Summary of the Invention

[0004] The purpose of the present invention is to solve the problem that large-volume TIFF images cannot be imported into AutoCAD software, and to provide a method for importing super-large TIFF images into AutoCAD.

[0005] The method for importing an oversized TIFF image into AutoCAD comprises the following steps:

[0006] Step 1: Specify the TIFF image to be loaded. The image file is a *.tfw file.

[0007] Step 2: Read the *.tfw file to get the gt array, and use the GDAL library to get the pixel size of the TIFF image, which are xSize, ySize and the plane coordinate range, which are MinX TIFF , MinY TIFF , MaxX TIFF , MaxY TIFF ;

[0008] Step 3: Get the TIFF image range to be loaded through the current viewport range of AutoCAD; the specific steps are as follows:

[0009] (1) Get the range of AntoCAD current viewport in the plane projection coordinate system, which are MinX Window , MinY Window , MaxX Window , MaxY Window and the current window size, Width and Height respectively;

[0010] (2) Determine the window range MinX Window , MinY Window , MaxX Window , MaxY WindowWith image range MinX TIFF , MinY TIFF , MaxX TIFF , MaxY TIFF Is there an intersection? If not, it means that the TIFF image does not need to be loaded in the current viewport. If there is an intersection, it means that the TIFF image needs to be loaded in the current viewport, and go to step (3);

[0011] (3) Calculate the intersection range MinX according to formula (1) Intersect , MinY Intersect , MaxX Intersect , MaxY Intersect , get the size Draw_Width and Draw_Height of the intersection range in the current viewport;

[0012]

[0013] (4) Calculate the starting pixel Xoff, Yoff and size Nxsize, Nysize of the part of the image that needs to be loaded according to formula (2);

[0014]

[0015] Step 4: Use the GDAL library to read the data of the image to be loaded and save it as a temporary image;

[0016] Step 5, use the AutoCAD insert raster image function to load the temporary image saved in step 4;

[0017] Step 6: If you need to change the current viewport, repeat steps 3-5 to achieve real-time dynamic loading of large TIFF images;

[0018] The meaning of the gt array described in step 2 is:

[0019] gt[0]: pixel resolution in the X direction, that is, the actual distance represented by one pixel;

[0020] gt[1]: rotation coefficient in the X direction;

[0021] gt[2]: rotation coefficient in the Y direction;

[0022] gt[3]: pixel resolution in the Y direction, i.e., the negative value of the actual distance represented by one pixel;

[0023] gt[4]: X coordinate of the center of the upper left pixel of the image, i.e., the minimum value in the X direction of the image;

[0024] gt[5]: the Y coordinate of the center of the upper left pixel of the image, i.e. the maximum value in the Y direction of the image;

[0025] The plane coordinate calculation formula of any pixel coordinate (i, j) on the image is as follows:

[0026]

[0027] Generally, images do not have rotation parameters, that is, gt[1] and gt[2] are both 0.

[0028] The GDAL library, standing for the Geospatial Data Abstraction Library, is an open-source raster spatial data conversion library. This invention features a rational design, high automation, high efficiency, good accuracy, and low cost. Specifically, it enables real-time dynamic loading of large-volume TIFF images within AutoCAD software, facilitating large-scale, integrated design work.

[0029] 2. The present invention has a high degree of automation, and the real-time dynamic loading efficiency meets the design requirements. BRIEF DESCRIPTION OF THE DRAWINGS

[0030] Figure 1 It is a flow chart of the method of the present invention.

[0031] Figure 2 It is the TIFF image and its attached files in Example 1.

[0032] Figure 3 This is the tfw file of Example 1 and its corresponding relationship with the gt array.

[0033] Figure 4 This is an example of importing TIFF images into CAD in Example 1.

[0034] Figure 5 This is an example of Example 1, which is to translate and load a TIFF image into a CAD file.

[0035] Figure 6 This is an example of Example 1, which shows how to import a reduced-size TIFF image into CAD.

[0036] Figure 7 This is an example of enlarging and loading a TIFF image into CAD in Example 1. DETAILED DESCRIPTION

[0037] Example 1: A method for importing an extremely large TIFF image into AutoCAD, comprising the following steps:

[0038] Step 1: Specify the TIFF image to be loaded; Figure 2 As shown in the figure, the TIFF image file to be loaded is 1.tif, and its size is 11.6GB.

[0039] Step 2, read the 1.tfw file to get the gt array; Figure 3 As shown, get the gt[0]-gt[5] values, and use the GDAL library to get the pixel size xSize: 86659, ySize: 48010 and the plane coordinate range MinX of the TIFF image. TIFF :486757,MinY TIFF :2552955,MaxX TIFF :573416,MaxY TIFF :2600965.

[0040] Step 3: Get the TIFF image range to be loaded through the current viewport range of AutoCAD; the specific steps are as follows:

[0041] (1) Get the range of AntoCAD current viewport in the plane projection coordinate system, which are MinX Window :510679,MinY Window :2558981,MaxX Window :558167,MaxY Window :2586325 and the current window size Width:1569,Height:904;

[0042] (2) Determine whether the window range and the image range have an intersection. If not, it means that the TIFF image does not need to be loaded into the current viewport. In this embodiment, an intersection exists, and the intersection range is calculated, and the TIFF image needs to be loaded into the current viewport;

[0043] (3) The intersection range is calculated as MinX Intersect :510679,MinY Intersect :2558981,MaxX Intersect :558167,MaxY Intersect : 2586325, the size of the intersection range in the current viewport is Draw_Width: 1569, Draw_Height: 904;

[0044] (4) The starting pixel and size of the part of the image that needs to be loaded are calculated using formula (2). The starting pixel is calculated to be Xoff: 23922, Yoff: 14640, and the size is Nxsize: 47488, Nysize: 27344.

[0045] Step 4: Use the GDAL library to read the data of the image to be loaded and save it as a temporary image;

[0046] Step 5: Use the AutoCAD insert raster image function to load the temporary image saved in step 4, such as Figure 4 As shown;

[0047] Step 6: If you need to change the current viewport, repeat steps 3-5 to achieve real-time dynamic loading of large TIFF images. Figure 5-7 shown.

Claims

1. The method of importing large TIFF images into AutoCAD is characterized by The following steps are involved: Step 1: Specify the TIFF image to be loaded. The image file is a *.tfw file. Step 2: Read the *.tfw file to get the gt array, and use the GDAL library to get the pixel size of the TIFF image, which are xSize, ySize and the plane coordinate range, which are MinX TIFF , MinY TIFF , MaxX TIFF , MaxY TIFF ; Step 3: Get the TIFF image range to be loaded through the current viewport range of AutoCAD; the specific steps are as follows: (1) Get the range of AntoCAD current viewport in the plane projection coordinate system, which are MinX Window , MinY Window , MaxX Window , MaxY Window and the current window size, Width and Height respectively; (2) Determine the window range MinX Window , MinY Window , MaxX Window , MaxY Window With image range MinX TIFF , MinY TIFF , MaxX TIFF , MaxY TIFF Is there an intersection? If not, it means that the TIFF image does not need to be loaded in the current viewport. If there is an intersection, it means that the TIFF image needs to be loaded in the current viewport, and go to step (3); (3) Calculate the intersection range MinX according to formula (1) Intersect , MinY Intersect , MaxX Intersect , MaxY Intersect , get the size Draw_Width and Draw_Height of the intersection range in the current viewport; (4) Calculate the starting pixel Xoff, Yoff and size Nxsize, Nysize of the part of the image that needs to be loaded according to formula (2); Step 4: Use the GDAL library to read the data of the image to be loaded and save it as a temporary image; Step 5, use the AutoCAD insert raster image function to load the temporary image saved in step 4; Step 6: If you need to change the current viewport, repeat steps 3-5 to achieve real-time dynamic loading of large TIFF images; The meaning of the gt array is: gt[0]: pixel resolution in the X direction, that is, the actual distance represented by one pixel; gt[1]: rotation coefficient in the X direction; gt[2]: rotation coefficient in the Y direction; gt[3]: pixel resolution in the Y direction, i.e., the negative value of the actual distance represented by one pixel; gt[4]: X coordinate of the center of the upper left pixel of the image, i.e., the minimum value in the X direction of the image; gt[5]: the Y coordinate of the center of the upper left pixel of the image, i.e. the maximum value in the Y direction of the image; The plane coordinate calculation formula of any pixel coordinate (i, j) on the image is as follows: Generally, images do not have rotation parameters, that is, gt[1] and gt[2] are both 0.

Citation Information

Patent Citations

  • Method for intercepting google earth image and directly applying in engineering design

    CN105279341A

  • Orthographic image file processing method and device for AutoCAD and storage medium

    CN112215739A