1

I have received file geodatabase (FGDB) and it has images added in raster field type (in attribute table). I wanted to extract these images using ArcPy into the folder.

Does someone have a solution?

I have observed that if we put images in the raster field managed by GDB, the size of GDB increases so much, as per my understanding, it converts images into tables as per pixel value.

1

Check out the details per this ArcPy code from How To: Batch export attachments from a feature class in ArcMap:

There are no geoprocessing tools that allow users to export and save all attachments locally. The instructions provided below describe how to execute a possible solution by creating a script tool to accomplish the task.

import arcpy
from arcpy import da
import os

inTable = arcpy.GetParameterAsText(0)
fileLocation = arcpy.GetParameterAsText(1)

with da.SearchCursor(inTable, ['DATA', 'ATT_NAME', 'ATTACHMENTID']) as cursor:
    for item in cursor:
        attachment = item[0]
        filenum = "ATT" + str(item[2]) + "_"
        filename = filenum + str(item[1])
        open(fileLocation + os.sep + filename, 'wb').write(attachment.tobytes())
        del item
        del filenum
        del filename
        del attachment

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.