1 /* This file is part of the Pangolin Project. 2 * http://github.com/stevenlovegrove/Pangolin 3 * 4 * Copyright (c) 2013 Steven Lovegrove 5 * 6 * Permission is hereby granted, free of charge, to any person 7 * obtaining a copy of this software and associated documentation 8 * files (the "Software"), to deal in the Software without 9 * restriction, including without limitation the rights to use, 10 * copy, modify, merge, publish, distribute, sublicense, and/or sell 11 * copies of the Software, and to permit persons to whom the 12 * Software is furnished to do so, subject to the following 13 * conditions: 14 * 15 * The above copyright notice and this permission notice shall be 16 * included in all copies or substantial portions of the Software. 17 * 18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 20 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 21 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 22 * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 24 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 25 * OTHER DEALINGS IN THE SOFTWARE. 26 */ 27 28 #pragma once 29 30 #include <pangolin/platform.h> 31 32 #include <pangolin/image/typed_image.h> 33 #include <pangolin/utils/file_extension.h> 34 35 namespace pangolin { 36 37 PANGOLIN_EXPORT 38 TypedImage LoadImage(std::istream& in, ImageFileType file_type); 39 40 PANGOLIN_EXPORT 41 TypedImage LoadImage(const std::string& filename, ImageFileType file_type); 42 43 PANGOLIN_EXPORT 44 TypedImage LoadImage(const std::string& filename); 45 46 PANGOLIN_EXPORT 47 TypedImage LoadImage(const std::string& filename, const PixelFormat& raw_fmt, size_t raw_width, size_t raw_height, size_t raw_pitch); 48 49 /// Quality \in [0..100] for lossy formats 50 PANGOLIN_EXPORT 51 void SaveImage(const Image<unsigned char>& image, const pangolin::PixelFormat& fmt, std::ostream& out, ImageFileType file_type, bool top_line_first = true, float quality = 100.0f); 52 53 /// Quality \in [0..100] for lossy formats 54 PANGOLIN_EXPORT 55 void SaveImage(const Image<unsigned char>& image, const pangolin::PixelFormat& fmt, const std::string& filename, ImageFileType file_type, bool top_line_first = true, float quality = 100.0f); 56 57 /// Quality \in [0..100] for lossy formats 58 PANGOLIN_EXPORT 59 void SaveImage(const Image<unsigned char>& image, const pangolin::PixelFormat& fmt, const std::string& filename, bool top_line_first = true, float quality = 100.0f); 60 61 /// Quality \in [0..100] for lossy formats 62 PANGOLIN_EXPORT 63 void SaveImage(const TypedImage& image, const std::string& filename, bool top_line_first = true, float quality = 100.0f); 64 65 } 66