plugins.py 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782
  1. import importlib
  2. from ..core.legacy_plugin_wrapper import LegacyPlugin
  3. class PluginConfig:
  4. """Plugin Configuration Metadata
  5. This class holds the information needed to lazy-import plugins.
  6. Parameters
  7. ----------
  8. name : str
  9. The name of the plugin.
  10. class_name : str
  11. The name of the plugin class inside the plugin module.
  12. module_name : str
  13. The name of the module/package from which to import the plugin.
  14. is_legacy : bool
  15. If True, this plugin is a v2 plugin and will be wrapped in a
  16. LegacyPlugin. Default: False.
  17. package_name : str
  18. If the given module name points to a relative module, then the package
  19. name determines the package it is relative to.
  20. install_name : str
  21. The name of the optional dependency that can be used to install this
  22. plugin if it is missing.
  23. legacy_args : Dict
  24. A dictionary of kwargs to pass to the v2 plugin (Format) upon construction.
  25. Examples
  26. --------
  27. >>> PluginConfig(
  28. name="TIFF",
  29. class_name="TiffFormat",
  30. module_name="imageio.plugins.tifffile",
  31. is_legacy=True,
  32. install_name="tifffile",
  33. legacy_args={
  34. "description": "TIFF format",
  35. "extensions": ".tif .tiff .stk .lsm",
  36. "modes": "iIvV",
  37. },
  38. )
  39. >>> PluginConfig(
  40. name="pillow",
  41. class_name="PillowPlugin",
  42. module_name="imageio.plugins.pillow"
  43. )
  44. """
  45. def __init__(
  46. self,
  47. name,
  48. class_name,
  49. module_name,
  50. *,
  51. is_legacy=False,
  52. package_name=None,
  53. install_name=None,
  54. legacy_args=None,
  55. ):
  56. legacy_args = legacy_args or dict()
  57. self.name = name
  58. self.class_name = class_name
  59. self.module_name = module_name
  60. self.package_name = package_name
  61. self.is_legacy = is_legacy
  62. self.install_name = install_name or self.name
  63. self.legacy_args = {"name": name, "description": "A legacy plugin"}
  64. self.legacy_args.update(legacy_args)
  65. @property
  66. def format(self):
  67. """For backwards compatibility with FormatManager
  68. Delete when migrating to v3
  69. """
  70. if not self.is_legacy:
  71. raise RuntimeError("Can only get format for legacy plugins.")
  72. module = importlib.import_module(self.module_name, self.package_name)
  73. clazz = getattr(module, self.class_name)
  74. return clazz(**self.legacy_args)
  75. @property
  76. def plugin_class(self):
  77. """Get the plugin class (import if needed)
  78. Returns
  79. -------
  80. plugin_class : Any
  81. The class that can be used to instantiate plugins.
  82. """
  83. module = importlib.import_module(self.module_name, self.package_name)
  84. clazz = getattr(module, self.class_name)
  85. if self.is_legacy:
  86. legacy_plugin = clazz(**self.legacy_args)
  87. def partial_legacy_plugin(request):
  88. return LegacyPlugin(request, legacy_plugin)
  89. clazz = partial_legacy_plugin
  90. return clazz
  91. known_plugins = dict()
  92. known_plugins["pillow"] = PluginConfig(
  93. name="pillow", class_name="PillowPlugin", module_name="imageio.plugins.pillow"
  94. )
  95. known_plugins["pyav"] = PluginConfig(
  96. name="pyav", class_name="PyAVPlugin", module_name="imageio.plugins.pyav"
  97. )
  98. known_plugins["opencv"] = PluginConfig(
  99. name="opencv", class_name="OpenCVPlugin", module_name="imageio.plugins.opencv"
  100. )
  101. known_plugins["tifffile"] = PluginConfig(
  102. name="tifffile",
  103. class_name="TifffilePlugin",
  104. module_name="imageio.plugins.tifffile_v3",
  105. )
  106. known_plugins["SPE"] = PluginConfig(
  107. name="spe", class_name="SpePlugin", module_name="imageio.plugins.spe"
  108. )
  109. known_plugins["rawpy"] = PluginConfig(
  110. name="rawpy", class_name="RawPyPlugin", module_name="imageio.plugins.rawpy"
  111. )
  112. # Legacy plugins
  113. # ==============
  114. #
  115. # Which are partly registered by format, partly by plugin, and partly by a mix
  116. # of both. We keep the naming here for backwards compatibility.
  117. # In v3 this should become a single entry per plugin named after the plugin
  118. # We can choose extension-specific priority in ``config.extensions``.
  119. #
  120. # Note: Since python 3.7 order of insertion determines the order of dict().keys()
  121. # This means that the order here determines the order by which plugins are
  122. # checked during the full fallback search. We don't advertise this downstream,
  123. # but it could be a useful thing to keep in mind to choose a sensible default
  124. # search order.
  125. known_plugins["TIFF"] = PluginConfig(
  126. name="TIFF",
  127. class_name="TiffFormat",
  128. module_name="imageio.plugins.tifffile",
  129. is_legacy=True,
  130. install_name="tifffile",
  131. legacy_args={
  132. "description": "TIFF format",
  133. "extensions": ".tif .tiff .stk .lsm",
  134. "modes": "iIvV",
  135. },
  136. )
  137. # PILLOW plugin formats (legacy)
  138. PILLOW_FORMATS = [
  139. ("BMP", "Windows Bitmap", ".bmp", "PillowFormat"),
  140. ("BUFR", "BUFR", ".bufr", "PillowFormat"),
  141. ("CUR", "Windows Cursor", ".cur", "PillowFormat"),
  142. ("DCX", "Intel DCX", ".dcx", "PillowFormat"),
  143. ("DDS", "DirectDraw Surface", ".dds", "PillowFormat"),
  144. ("DIB", "Windows Bitmap", "", "PillowFormat"),
  145. ("EPS", "Encapsulated Postscript", ".ps .eps", "PillowFormat"),
  146. ("FITS", "FITS", ".fit .fits", "PillowFormat"),
  147. ("FLI", "Autodesk FLI/FLC Animation", ".fli .flc", "PillowFormat"),
  148. ("FPX", "FlashPix", ".fpx", "PillowFormat"),
  149. ("FTEX", "Texture File Format (IW2:EOC)", ".ftc .ftu", "PillowFormat"),
  150. ("GBR", "GIMP brush file", ".gbr", "PillowFormat"),
  151. ("GIF", "Compuserve GIF", ".gif", "GIFFormat"),
  152. ("GRIB", "GRIB", ".grib", "PillowFormat"),
  153. ("HDF5", "HDF5", ".h5 .hdf", "PillowFormat"),
  154. ("ICNS", "Mac OS icns resource", ".icns", "PillowFormat"),
  155. ("ICO", "Windows Icon", ".ico", "PillowFormat"),
  156. ("IM", "IFUNC Image Memory", ".im", "PillowFormat"),
  157. ("IMT", "IM Tools", "", "PillowFormat"),
  158. ("IPTC", "IPTC/NAA", ".iim", "PillowFormat"),
  159. ("JPEG", "JPEG (ISO 10918)", ".jfif .jpe .jpg .jpeg", "JPEGFormat"),
  160. (
  161. "JPEG2000",
  162. "JPEG 2000 (ISO 15444)",
  163. ".jp2 .j2k .jpc .jpf .jpx .j2c",
  164. "JPEG2000Format",
  165. ),
  166. ("MCIDAS", "McIdas area file", "", "PillowFormat"),
  167. ("MIC", "Microsoft Image Composer", ".mic", "PillowFormat"),
  168. # skipped in legacy pillow
  169. # ("MPEG", "MPEG", ".mpg .mpeg", "PillowFormat"),
  170. ("MPO", "MPO (CIPA DC-007)", ".mpo", "PillowFormat"),
  171. ("MSP", "Windows Paint", ".msp", "PillowFormat"),
  172. ("PCD", "Kodak PhotoCD", ".pcd", "PillowFormat"),
  173. ("PCX", "Paintbrush", ".pcx", "PillowFormat"),
  174. ("PIXAR", "PIXAR raster image", ".pxr", "PillowFormat"),
  175. ("PNG", "Portable network graphics", ".png", "PNGFormat"),
  176. ("PPM", "Pbmplus image", ".pbm .pgm .ppm", "PillowFormat"),
  177. ("PSD", "Adobe Photoshop", ".psd", "PillowFormat"),
  178. ("SGI", "SGI Image File Format", ".bw .rgb .rgba .sgi", "PillowFormat"),
  179. ("SPIDER", "Spider 2D image", "", "PillowFormat"),
  180. ("SUN", "Sun Raster File", ".ras", "PillowFormat"),
  181. ("TGA", "Targa", ".tga", "PillowFormat"),
  182. ("TIFF", "Adobe TIFF", ".tif .tiff", "TIFFFormat"),
  183. ("WMF", "Windows Metafile", ".wmf .emf", "PillowFormat"),
  184. ("XBM", "X11 Bitmap", ".xbm", "PillowFormat"),
  185. ("XPM", "X11 Pixel Map", ".xpm", "PillowFormat"),
  186. ("XVTHUMB", "XV thumbnail image", "", "PillowFormat"),
  187. ]
  188. for id, summary, ext, class_name in PILLOW_FORMATS:
  189. config = PluginConfig(
  190. name=id.upper() + "-PIL",
  191. class_name=class_name,
  192. module_name="imageio.plugins.pillow_legacy",
  193. is_legacy=True,
  194. install_name="pillow",
  195. legacy_args={
  196. "description": summary + " via Pillow",
  197. "extensions": ext,
  198. "modes": "iI" if class_name == "GIFFormat" else "i",
  199. "plugin_id": id,
  200. },
  201. )
  202. known_plugins[config.name] = config
  203. known_plugins["FFMPEG"] = PluginConfig(
  204. name="FFMPEG",
  205. class_name="FfmpegFormat",
  206. module_name="imageio.plugins.ffmpeg",
  207. is_legacy=True,
  208. install_name="ffmpeg",
  209. legacy_args={
  210. "description": "Many video formats and cameras (via ffmpeg)",
  211. "extensions": ".mov .avi .mpg .mpeg .mp4 .mkv .webm .wmv .h264",
  212. "modes": "I",
  213. },
  214. )
  215. known_plugins["BSDF"] = PluginConfig(
  216. name="BSDF",
  217. class_name="BsdfFormat",
  218. module_name="imageio.plugins.bsdf",
  219. is_legacy=True,
  220. install_name="bsdf",
  221. legacy_args={
  222. "description": "Format based on the Binary Structured Data Format",
  223. "extensions": ".bsdf",
  224. "modes": "iIvV",
  225. },
  226. )
  227. known_plugins["DICOM"] = PluginConfig(
  228. name="DICOM",
  229. class_name="DicomFormat",
  230. module_name="imageio.plugins.dicom",
  231. is_legacy=True,
  232. install_name="dicom",
  233. legacy_args={
  234. "description": "Digital Imaging and Communications in Medicine",
  235. "extensions": ".dcm .ct .mri",
  236. "modes": "iIvV",
  237. },
  238. )
  239. known_plugins["FEI"] = PluginConfig(
  240. name="FEI",
  241. class_name="FEISEMFormat",
  242. module_name="imageio.plugins.feisem",
  243. is_legacy=True,
  244. install_name="feisem",
  245. legacy_args={
  246. "description": "FEI-SEM TIFF format",
  247. "extensions": [".tif", ".tiff"],
  248. "modes": "iv",
  249. },
  250. )
  251. known_plugins["FITS"] = PluginConfig(
  252. name="FITS",
  253. class_name="FitsFormat",
  254. module_name="imageio.plugins.fits",
  255. is_legacy=True,
  256. install_name="fits",
  257. legacy_args={
  258. "description": "Flexible Image Transport System (FITS) format",
  259. "extensions": ".fits .fit .fts .fz",
  260. "modes": "iIvV",
  261. },
  262. )
  263. known_plugins["GDAL"] = PluginConfig(
  264. name="GDAL",
  265. class_name="GdalFormat",
  266. module_name="imageio.plugins.gdal",
  267. is_legacy=True,
  268. install_name="gdal",
  269. legacy_args={
  270. "description": "Geospatial Data Abstraction Library",
  271. "extensions": ".tiff .tif .img .ecw .jpg .jpeg",
  272. "modes": "iIvV",
  273. },
  274. )
  275. known_plugins["ITK"] = PluginConfig(
  276. name="ITK",
  277. class_name="ItkFormat",
  278. module_name="imageio.plugins.simpleitk",
  279. is_legacy=True,
  280. install_name="simpleitk",
  281. legacy_args={
  282. "description": "Insight Segmentation and Registration Toolkit (ITK) format",
  283. "extensions": " ".join(
  284. (
  285. ".gipl",
  286. ".ipl",
  287. ".mha",
  288. ".mhd",
  289. ".nhdr",
  290. ".nia",
  291. ".hdr",
  292. ".nrrd",
  293. ".nii",
  294. ".nii.gz",
  295. ".img",
  296. ".img.gz",
  297. ".vtk",
  298. ".hdf5",
  299. ".lsm",
  300. ".mnc",
  301. ".mnc2",
  302. ".mgh",
  303. ".mnc",
  304. ".pic",
  305. ".bmp",
  306. ".jpeg",
  307. ".jpg",
  308. ".png",
  309. ".tiff",
  310. ".tif",
  311. ".dicom",
  312. ".dcm",
  313. ".gdcm",
  314. )
  315. ),
  316. "modes": "iIvV",
  317. },
  318. )
  319. known_plugins["NPZ"] = PluginConfig(
  320. name="NPZ",
  321. class_name="NpzFormat",
  322. module_name="imageio.plugins.npz",
  323. is_legacy=True,
  324. install_name="numpy",
  325. legacy_args={
  326. "description": "Numpy's compressed array format",
  327. "extensions": ".npz",
  328. "modes": "iIvV",
  329. },
  330. )
  331. known_plugins["SWF"] = PluginConfig(
  332. name="SWF",
  333. class_name="SWFFormat",
  334. module_name="imageio.plugins.swf",
  335. is_legacy=True,
  336. install_name="swf",
  337. legacy_args={
  338. "description": "Shockwave flash",
  339. "extensions": ".swf",
  340. "modes": "I",
  341. },
  342. )
  343. known_plugins["SCREENGRAB"] = PluginConfig(
  344. name="SCREENGRAB",
  345. class_name="ScreenGrabFormat",
  346. module_name="imageio.plugins.grab",
  347. is_legacy=True,
  348. install_name="pillow",
  349. legacy_args={
  350. "description": "Grab screenshots (Windows and OS X only)",
  351. "extensions": [],
  352. "modes": "i",
  353. },
  354. )
  355. known_plugins["CLIPBOARDGRAB"] = PluginConfig(
  356. name="CLIPBOARDGRAB",
  357. class_name="ClipboardGrabFormat",
  358. module_name="imageio.plugins.grab",
  359. is_legacy=True,
  360. install_name="pillow",
  361. legacy_args={
  362. "description": "Grab from clipboard (Windows only)",
  363. "extensions": [],
  364. "modes": "i",
  365. },
  366. )
  367. # LYTRO plugin (legacy)
  368. lytro_formats = [
  369. ("lytro-lfr", "Lytro Illum lfr image file", ".lfr", "i", "LytroLfrFormat"),
  370. (
  371. "lytro-illum-raw",
  372. "Lytro Illum raw image file",
  373. ".raw",
  374. "i",
  375. "LytroIllumRawFormat",
  376. ),
  377. ("lytro-lfp", "Lytro F01 lfp image file", ".lfp", "i", "LytroLfpFormat"),
  378. ("lytro-f01-raw", "Lytro F01 raw image file", ".raw", "i", "LytroF01RawFormat"),
  379. ]
  380. for name, des, ext, mode, class_name in lytro_formats:
  381. config = PluginConfig(
  382. name=name.upper(),
  383. class_name=class_name,
  384. module_name="imageio.plugins.lytro",
  385. is_legacy=True,
  386. install_name="lytro",
  387. legacy_args={
  388. "description": des,
  389. "extensions": ext,
  390. "modes": mode,
  391. },
  392. )
  393. known_plugins[config.name] = config
  394. # FreeImage plugin (legacy)
  395. FREEIMAGE_FORMATS = [
  396. (
  397. "BMP",
  398. 0,
  399. "Windows or OS/2 Bitmap",
  400. ".bmp",
  401. "i",
  402. "FreeimageBmpFormat",
  403. "imageio.plugins.freeimage",
  404. ),
  405. (
  406. "CUT",
  407. 21,
  408. "Dr. Halo",
  409. ".cut",
  410. "i",
  411. "FreeimageFormat",
  412. "imageio.plugins.freeimage",
  413. ),
  414. (
  415. "DDS",
  416. 24,
  417. "DirectX Surface",
  418. ".dds",
  419. "i",
  420. "FreeimageFormat",
  421. "imageio.plugins.freeimage",
  422. ),
  423. (
  424. "EXR",
  425. 29,
  426. "ILM OpenEXR",
  427. ".exr",
  428. "i",
  429. "FreeimageFormat",
  430. "imageio.plugins.freeimage",
  431. ),
  432. (
  433. "G3",
  434. 27,
  435. "Raw fax format CCITT G.3",
  436. ".g3",
  437. "i",
  438. "FreeimageFormat",
  439. "imageio.plugins.freeimage",
  440. ),
  441. (
  442. "GIF",
  443. 25,
  444. "Static and animated gif (FreeImage)",
  445. ".gif",
  446. "iI",
  447. "GifFormat",
  448. "imageio.plugins.freeimagemulti",
  449. ),
  450. (
  451. "HDR",
  452. 26,
  453. "High Dynamic Range Image",
  454. ".hdr",
  455. "i",
  456. "FreeimageFormat",
  457. "imageio.plugins.freeimage",
  458. ),
  459. (
  460. "ICO",
  461. 1,
  462. "Windows Icon",
  463. ".ico",
  464. "iI",
  465. "IcoFormat",
  466. "imageio.plugins.freeimagemulti",
  467. ),
  468. (
  469. "IFF",
  470. 5,
  471. "IFF Interleaved Bitmap",
  472. ".iff .lbm",
  473. "i",
  474. "FreeimageFormat",
  475. "imageio.plugins.freeimage",
  476. ),
  477. (
  478. "J2K",
  479. 30,
  480. "JPEG-2000 codestream",
  481. ".j2k .j2c",
  482. "i",
  483. "FreeimageFormat",
  484. "imageio.plugins.freeimage",
  485. ),
  486. (
  487. "JNG",
  488. 3,
  489. "JPEG Network Graphics",
  490. ".jng",
  491. "i",
  492. "FreeimageFormat",
  493. "imageio.plugins.freeimage",
  494. ),
  495. (
  496. "JP2",
  497. 31,
  498. "JPEG-2000 File Format",
  499. ".jp2",
  500. "i",
  501. "FreeimageFormat",
  502. "imageio.plugins.freeimage",
  503. ),
  504. (
  505. "JPEG",
  506. 2,
  507. "JPEG - JFIF Compliant",
  508. ".jpg .jif .jpeg .jpe",
  509. "i",
  510. "FreeimageJpegFormat",
  511. "imageio.plugins.freeimage",
  512. ),
  513. (
  514. "JPEG-XR",
  515. 36,
  516. "JPEG XR image format",
  517. ".jxr .wdp .hdp",
  518. "i",
  519. "FreeimageFormat",
  520. "imageio.plugins.freeimage",
  521. ),
  522. (
  523. "KOALA",
  524. 4,
  525. "C64 Koala Graphics",
  526. ".koa",
  527. "i",
  528. "FreeimageFormat",
  529. "imageio.plugins.freeimage",
  530. ),
  531. # not registered in legacy pillow
  532. # ("MNG", 6, "Multiple-image Network Graphics", ".mng", "i", "FreeimageFormat", "imageio.plugins.freeimage"),
  533. (
  534. "PBM",
  535. 7,
  536. "Portable Bitmap (ASCII)",
  537. ".pbm",
  538. "i",
  539. "FreeimageFormat",
  540. "imageio.plugins.freeimage",
  541. ),
  542. (
  543. "PBMRAW",
  544. 8,
  545. "Portable Bitmap (RAW)",
  546. ".pbm",
  547. "i",
  548. "FreeimageFormat",
  549. "imageio.plugins.freeimage",
  550. ),
  551. (
  552. "PCD",
  553. 9,
  554. "Kodak PhotoCD",
  555. ".pcd",
  556. "i",
  557. "FreeimageFormat",
  558. "imageio.plugins.freeimage",
  559. ),
  560. (
  561. "PCX",
  562. 10,
  563. "Zsoft Paintbrush",
  564. ".pcx",
  565. "i",
  566. "FreeimageFormat",
  567. "imageio.plugins.freeimage",
  568. ),
  569. (
  570. "PFM",
  571. 32,
  572. "Portable floatmap",
  573. ".pfm",
  574. "i",
  575. "FreeimageFormat",
  576. "imageio.plugins.freeimage",
  577. ),
  578. (
  579. "PGM",
  580. 11,
  581. "Portable Greymap (ASCII)",
  582. ".pgm",
  583. "i",
  584. "FreeimageFormat",
  585. "imageio.plugins.freeimage",
  586. ),
  587. (
  588. "PGMRAW",
  589. 12,
  590. "Portable Greymap (RAW)",
  591. ".pgm",
  592. "i",
  593. "FreeimageFormat",
  594. "imageio.plugins.freeimage",
  595. ),
  596. (
  597. "PICT",
  598. 33,
  599. "Macintosh PICT",
  600. ".pct .pict .pic",
  601. "i",
  602. "FreeimageFormat",
  603. "imageio.plugins.freeimage",
  604. ),
  605. (
  606. "PNG",
  607. 13,
  608. "Portable Network Graphics",
  609. ".png",
  610. "i",
  611. "FreeimagePngFormat",
  612. "imageio.plugins.freeimage",
  613. ),
  614. (
  615. "PPM",
  616. 14,
  617. "Portable Pixelmap (ASCII)",
  618. ".ppm",
  619. "i",
  620. "FreeimagePnmFormat",
  621. "imageio.plugins.freeimage",
  622. ),
  623. (
  624. "PPMRAW",
  625. 15,
  626. "Portable Pixelmap (RAW)",
  627. ".ppm",
  628. "i",
  629. "FreeimagePnmFormat",
  630. "imageio.plugins.freeimage",
  631. ),
  632. (
  633. "PSD",
  634. 20,
  635. "Adobe Photoshop",
  636. ".psd",
  637. "i",
  638. "FreeimageFormat",
  639. "imageio.plugins.freeimage",
  640. ),
  641. (
  642. "RAS",
  643. 16,
  644. "Sun Raster Image",
  645. ".ras",
  646. "i",
  647. "FreeimageFormat",
  648. "imageio.plugins.freeimage",
  649. ),
  650. (
  651. "RAW",
  652. 34,
  653. "RAW camera image",
  654. ".3fr .arw .bay .bmq .cap .cine .cr2 .crw .cs1 .dc2 "
  655. ".dcr .drf .dsc .dng .erf .fff .ia .iiq .k25 .kc2 .kdc .mdc .mef .mos .mrw .nef .nrw .orf "
  656. ".pef .ptx .pxn .qtk .raf .raw .rdc .rw2 .rwl .rwz .sr2 .srf .srw .sti",
  657. "i",
  658. "FreeimageFormat",
  659. "imageio.plugins.freeimage",
  660. ),
  661. (
  662. "SGI",
  663. 28,
  664. "SGI Image Format",
  665. ".sgi .rgb .rgba .bw",
  666. "i",
  667. "FreeimageFormat",
  668. "imageio.plugins.freeimage",
  669. ),
  670. (
  671. "TARGA",
  672. 17,
  673. "Truevision Targa",
  674. ".tga .targa",
  675. "i",
  676. "FreeimageFormat",
  677. "imageio.plugins.freeimage",
  678. ),
  679. (
  680. "TIFF",
  681. 18,
  682. "Tagged Image File Format",
  683. ".tif .tiff",
  684. "i",
  685. "FreeimageFormat",
  686. "imageio.plugins.freeimage",
  687. ),
  688. (
  689. "WBMP",
  690. 19,
  691. "Wireless Bitmap",
  692. ".wap .wbmp .wbm",
  693. "i",
  694. "FreeimageFormat",
  695. "imageio.plugins.freeimage",
  696. ),
  697. (
  698. "WebP",
  699. 35,
  700. "Google WebP image format",
  701. ".webp",
  702. "i",
  703. "FreeimageFormat",
  704. "imageio.plugins.freeimage",
  705. ),
  706. (
  707. "XBM",
  708. 22,
  709. "X11 Bitmap Format",
  710. ".xbm",
  711. "i",
  712. "FreeimageFormat",
  713. "imageio.plugins.freeimage",
  714. ),
  715. (
  716. "XPM",
  717. 23,
  718. "X11 Pixmap Format",
  719. ".xpm",
  720. "i",
  721. "FreeimageFormat",
  722. "imageio.plugins.freeimage",
  723. ),
  724. ]
  725. for name, i, des, ext, mode, class_name, module_name in FREEIMAGE_FORMATS:
  726. config = PluginConfig(
  727. name=name.upper() + "-FI",
  728. class_name=class_name,
  729. module_name=module_name,
  730. is_legacy=True,
  731. install_name="freeimage",
  732. legacy_args={
  733. "description": des,
  734. "extensions": ext,
  735. "modes": mode,
  736. "fif": i,
  737. },
  738. )
  739. known_plugins[config.name] = config
  740. # exists for backwards compatibility with FormatManager
  741. # delete in V3
  742. _original_order = [x for x, config in known_plugins.items() if config.is_legacy]