1
$\begingroup$

I'm trying to use WebImageSearch[] to get a bunch of images and basic metadata about them. According to the documentation, we can get the following info:

enter image description here

Is it possible to get all of these for a single query/search? For instance, I tried doing the following, but it does not work:

WebImageSearch["cats", {"Images", "ImageHyperlinks", "PageTitles", "PageHyperlinks"}, MaxItems -> 4]

Only individual elements give the proper results:

enter image description here

This would be important to save service credits, as these searches can cost a lot with the amount of searches I'd like to do.

Thank you!

$\endgroup$
1

1 Answer 1

1
$\begingroup$

Seems as only single elements can be obtained by Import

     cats = WebImageSearch["cats", "ImageHyperlinks", MaxItems -> 4]

     el = Import[cats[[1]], {"Elements"}]

So I import per map into the elements

      Import[cats[[1, 1]] , #] & /@ el[[{1, 3, 5, 6, 10, 10, 12}]]

{8, 3, ColorProfileData[NumericArray[CompressedData["..."],"UnsignedInteger8"], "RGB", "XYZ"], "RGB", <|"Make" -> "Canon", "Model" -> "Canon EOS 5D Mark III", "XResolution" -> 240, "YResolution" -> 240, "ResolutionUnit" -> "Inch", "Software" -> "Adobe Photoshop Lightroom 4.1 (Windows)", "DateTime" -> DateObject[{2012, 10, 7, 20, 50, 1.}, "Instant", "Gregorian", None], "ExposureTime" -> Quantity[1/200, "Seconds"], "FNumber" -> "f/2.8", "ExifTag" -> 214, "ExposureProgram" -> "Manual", "ISOSpeedRatings" -> 1600, "SensitivityType" -> "Recommended Exposure Index", "RecommendedExposureIndex" -> 1600, "ExifVersion" -> "2.30", "DateTimeOriginal" -> DateObject[{2012, 2, 14, 17, 56, 7.}, "Instant", "Gregorian", None], "DateTimeDigitized" -> DateObject[{2012, 2, 14, 17, 56, 7.}, "Instant", "Gregorian", None], "ShutterSpeedValue" -> Quantity[477741/62500, IndependentUnit["exposure values"]], "ApertureValue" -> Quantity[1485427/500000, IndependentUnit["exposure values"]], "ExposureBiasValue" -> Quantity[0, IndependentUnit["exposure values"]], "MaxApertureValue" -> Quantity[3., IndependentUnit["exposure values"]], "MeteringMode" -> "Multi-segment", "FlashInfo" -> <|"FlashUsed" -> False, "FlashFiringStatus" -> "No strobe return detection function", "FlashMode" -> "Compulsory flash firing", "FlashFunctionPresent" -> True, "RedEyeCorrection" -> False|>, "FocalLength" -> Quantity[185., "Millimeters"], "SubSecTimeOriginal" -> "00", "SubSecTimeDigitized" -> "00", "FocalPlaneXResolution" -> 160, "FocalPlaneYResolution" -> 160, "FocalPlaneResolutionUnit" -> "Millimeter", "CustomRendered" -> "Normal", "ExposureMode" -> "Manual", "WhiteBalance" -> Automatic, "SceneCaptureType" -> "Standard", "BodySerialNumber" -> "062124001701", "LensSpecification" -> {70, 200, Indeterminate, Indeterminate}, "LensModel" -> "EF70-200mm f/2.8L USM", "LensSerialNumber" -> "0000000000"|>, <|"Make" -> "Canon", "Model" -> "Canon EOS 5D Mark III", "XResolution" -> 240, "YResolution" -> 240, "ResolutionUnit" -> "Inch", "Software" -> "Adobe Photoshop Lightroom 4.1 (Windows)", "DateTime" -> DateObject[{2012, 10, 7, 20, 50, 1.}, "Instant", "Gregorian", None], "ExposureTime" -> Quantity[1/200, "Seconds"], "FNumber" -> "f/2.8", "ExifTag" -> 214, "ExposureProgram" -> "Manual", "ISOSpeedRatings" -> 1600, "SensitivityType" -> "Recommended Exposure Index", "RecommendedExposureIndex" -> 1600, "ExifVersion" -> "2.30", "DateTimeOriginal" -> DateObject[{2012, 2, 14, 17, 56, 7.}, "Instant", "Gregorian", None], "DateTimeDigitized" -> DateObject[{2012, 2, 14, 17, 56, 7.}, "Instant", "Gregorian", None], "ShutterSpeedValue" -> Quantity[477741/62500, IndependentUnit["exposure values"]], "ApertureValue" -> Quantity[1485427/500000, IndependentUnit["exposure values"]], "ExposureBiasValue" -> Quantity[0, IndependentUnit["exposure values"]], "MaxApertureValue" -> Quantity[3., IndependentUnit["exposure values"]], "MeteringMode" -> "Multi-segment", "FlashInfo" -> <|"FlashUsed" -> False, "FlashFiringStatus" -> "No strobe return detection function", "FlashMode" -> "Compulsory flash firing", "FlashFunctionPresent" -> True, "RedEyeCorrection" -> False|>, "FocalLength" -> Quantity[185., "Millimeters"], "SubSecTimeOriginal" -> "00", "SubSecTimeDigitized" -> "00", "FocalPlaneXResolution" -> 160, "FocalPlaneYResolution" -> 160, "FocalPlaneResolutionUnit" -> "Millimeter", "CustomRendered" -> "Normal", "ExposureMode" -> "Manual", "WhiteBalance" -> Automatic, "SceneCaptureType" -> "Standard", "BodySerialNumber" -> "062124001701", "LensSpecification" -> {70, 200, Indeterminate, Indeterminate}, "LensModel" -> "EF70-200mm f/2.8L USM", "LensSerialNumber" -> "0000000000"|>, None}

Its perhaps not a bad idea, to strip all metadata from jpgs before publishing. Its possible to track any camera body in space and time.

$\endgroup$
3
  • $\begingroup$ Interesting, that's quite a bit of data I didn't know would be able to get. Would this method use more credits than simply doing separate searches with the same search terms but different "element" queries? $\endgroup$ Commented Oct 27, 2023 at 19:36
  • $\begingroup$ Import does not use credits, it just imports data like a browser. $\endgroup$
    – Roland F
    Commented Oct 27, 2023 at 19:51
  • $\begingroup$ Ohh, I see. So this still relies on WebImageSearch[] for gathering the images and then gets the metadata. Good to know, but I'm mostly interested in fetching the images, url, and the other info that's supposed to be obtained with WebImageSearch[]. Thanks! $\endgroup$ Commented Oct 27, 2023 at 19:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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