{"library":"pyavm","title":"pyavm","description":"pyavm is a pure-Python library for reading and writing AVM (Astronomical Visualization Metadata) information to/from FITS and JPEG files. It leverages Astropy for FITS handling and Pillow for JPEG. The current version is 0.9.9, and it's actively maintained as part of the Astropy ecosystem, with regular but pre-1.0.0 releases.","language":"python","status":"active","last_verified":"Fri Apr 17","install":{"commands":["pip install pyavm","pip install pyavm[astropy,pil]"],"cli":null},"imports":["from pyavm import AVM"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"from pyavm import AVM\nfrom PIL import Image\nimport numpy as np\nimport os\n\n# --- Create a dummy image for demonstration ---\nimg_data = np.zeros((200, 300, 3), dtype=np.uint8)\ndummy_path = \"dummy_image.jpg\"\nImage.fromarray(img_data).save(dummy_path)\n\n# --- Example: Create and add AVM metadata to an image ---\navm = AVM()\navm.Creator = \"John Doe\"\navm.Subject = \"Test Astronomical Image\"\navm.Date = \"2024-04-17T12:00:00\"\navm.Spatial_Scale = 1.25 # arcsec/pixel\n\noutput_path = \"image_with_avm.jpg\"\n# Add spatial AVM metadata from the AVM object to the image\navm.add_spatial_to_image(dummy_path, output_path)\n\nprint(f\"AVM metadata added to '{output_path}'\")\n\n# --- Example: Read AVM metadata from an existing image ---\navm_read = AVM.from_image(output_path)\n\nprint(f\"\\nMetadata read from '{output_path}':\")\nprint(f\"  Creator: {avm_read.Creator}\")\nprint(f\"  Spatial Scale: {avm_read.Spatial_Scale}\")\n\n# --- Clean up generated files ---\nos.remove(dummy_path)\nos.remove(output_path)","lang":"python","description":"This quickstart demonstrates how to create an AVM object, populate it with metadata, embed this metadata into an existing JPEG image, and then read the AVM data back from the modified image. It uses Pillow to create a dummy image as a prerequisite.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}