{"id":20116325,"url":"https://github.com/cschreib/picam2fits","last_synced_at":"2026-04-30T19:31:20.133Z","repository":{"id":77388598,"uuid":"108012907","full_name":"cschreib/picam2fits","owner":"cschreib","description":"Command line tool to create FITS images from shots taken with the Raspberry Pi Camera v2.","archived":false,"fork":false,"pushed_at":"2018-06-21T10:49:03.000Z","size":11,"stargazers_count":3,"open_issues_count":1,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-06-09T21:46:40.060Z","etag":null,"topics":["fits-files","photometry","raspberry-pi","raspberry-pi-camera"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cschreib.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-10-23T17:06:11.000Z","updated_at":"2023-03-21T12:44:03.000Z","dependencies_parsed_at":null,"dependency_job_id":"bb819878-9842-4c91-b1fa-fe23b666084c","html_url":"https://github.com/cschreib/picam2fits","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/cschreib/picam2fits","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cschreib%2Fpicam2fits","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cschreib%2Fpicam2fits/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cschreib%2Fpicam2fits/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cschreib%2Fpicam2fits/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cschreib","download_url":"https://codeload.github.com/cschreib/picam2fits/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cschreib%2Fpicam2fits/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32475191,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-30T13:12:12.517Z","status":"ssl_error","status_checked_at":"2026-04-30T13:12:06.837Z","response_time":57,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["fits-files","photometry","raspberry-pi","raspberry-pi-camera"],"created_at":"2024-11-13T18:40:04.276Z","updated_at":"2026-04-30T19:31:20.117Z","avatar_url":"https://github.com/cschreib.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# picam2fits\n\nThis is a simple command line tool to convert, without loss of information, shots taken with the Raspberry Pi Camera v2 into FITS images. The shots must be taken with the ```--raw``` (```-r```) option of ```raspistill```:\n```bash\nraspistill -r -o image.jpg\npicam2fits image.jpg\n```\n\nThis will generate the file ```image.fits```, which contains four FITS extensions (plus the primary HDU, which is empty), one for each color channel: red, green, green (again), and blue. There are, indeed, two green channels because of the Bayer pattern of the camera's detector:\n```\n+--+--+--+--+--+\n|BG|BG|BG|BG|BG|\n|GR|GR|GR|GR|GR|\n+--+--+--+--+--+\n|BG|BG|BG|BG|BG|\n|GR|GR|GR|GR|GR|\n+--+--+--+--+--+\n|BG|BG|BG|BG|BG|\n|GR|GR|GR|GR|GR|\n+--+--+--+--+--+\n```\n\nThe image is shifted by half a pixel in the X and Y directions between the two green channels, and thus they provide independent information about the image. This is reflected in the WCS coordinate system, which provides the position of each pixel on the detector (in microns, from the bottom-left corner).\n\nThe output images have 1640x1232 pixels per channel, with integer values from 0 to 1023. The program will also read the JPG EXIF data to save the exposure time and date in the FITS header.\n\n\n# Install instructions\n\n```bash\nsudo apt-get install cmake libcfitsio-dev libexif-dev\ngit clone https://github.com/cschreib/picam2fits.git\ncd picam2fits\nmkdir build\ncd build\ncmake ../\nmake\nsudo make install\n```\n\n\n# Recommended camera settings and workflow\n\nIf you are interested in raw data and FITS files, you probably are working on a project that requires stable, repeatable observations. This should include first and foremost a stable camera configuration, without any of the automatic tuning that is used for casual photography. This can be achieved with the following:\n```bash\nANALOG_GAIN=1.0   # \u003e=1.0 and \u003c=8.0\nDIGITAL_GAIN=1.0  # \u003e=1.0\nEXPTIME=50000     # us\n\nraspistill -t 1 -ex auto -ag ${ANALOG_GAIN} -dg ${DIGITAL_GAIN} \\\n    -awb off -drc off -ss ${EXPTIME} -r -o image.jpg\n```\n\nThis setup offers a fixed exposure time ```EXPTIME``` (expressed in microseconds), no white balance correction or dynamic range compression, and a fixed ISO sensitivity through the choice of the analog and digital gains (this requires a recent version of ```raspistill```, from October 2017 onwards). You may tweak ```ANALOG_GAIN``` for your observed scene, so as to make best use of the camera's 10 bit dynamic range and avoid saturation. ```DIGITAL_GAIN``` should be left equal to one since it provides no advantage over the analog gain, and using it to go beyong the maximum analog gain of 8 only makes sense when dealing with 8 bit data.\n\nThe option ```-t 1``` disables the default 5 second delay before the image is actually captured. For even faster response, use the options ```-t 0 -s -fs 1 -v -o image_%d.jpg```. This will leave ```raspistill``` to run continuously, with the camera ready to shoot. You can then trigger a capture at any time by sending the ```SIGUSR1``` (10) signal to the program. To do so, simply run ```kill -s 10 $(pgrep raspistill)```. You can run this as many times as you wish, then take a last shot and terminate gracefully with ```kill -s 12 $(pgrep raspistill)```. The shots will be named ```image_1.jpg```, ```image_2.jpg```, and so on and so forth. You can finally convert them all to FITS files using ```picam2fits image_*.jpg```.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcschreib%2Fpicam2fits","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcschreib%2Fpicam2fits","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcschreib%2Fpicam2fits/lists"}