44 image = std::make_shared<Magick::Image>(path);
47 image->backgroundColor(Magick::Color(
"none"));
50 catch (
const Magick::Exception& e) {
52 throw InvalidFile(
"File could not be opened.", path);
98 "The ImageReader is closed. "
99 "Call Open() before calling this method.", path);
103 auto image_frame = std::make_shared<Frame>(
105 image->size().width(), image->size().height(),
110 image_frame->AddImage(qimage);
127 root[
"type"] =
"ImageReader";
142 catch (
const std::exception& e)
145 "JSON is invalid (missing keys or invalid data types)");
156 if (!root[
"path"].isNull())
157 path = root[
"path"].asString();
Header file for all Exception classes.
Header file for Frame class.
Header file for ImageReader class.
Header file for MagickUtilities (IM6/IM7 compatibility overlay)
#define MAGICK_IMAGE_ALPHA(im, a)
Header file for QtUtilities (compatibiity overlay)
This class represents a fraction.
int num
Numerator for the fraction.
double ToDouble() const
Return this fraction as a double (i.e. 1/2 = 0.5)
void Reduce()
Reduce this fraction (i.e. 640/480 = 4/3)
Fraction Reciprocal() const
Return the reciprocal as a Fraction.
int den
Denominator for the fraction.
void Open() override
Open File - which is called by the constructor automatically.
std::shared_ptr< Frame > GetFrame(int64_t requested_frame) override
ImageReader(const std::string &path, bool inspect_reader=true)
Constructor for ImageReader.
void SetJson(const std::string value) override
Load JSON string into this object.
void SetJsonValue(const Json::Value root) override
Load Json::Value into this object.
Json::Value JsonValue() const override
Generate Json::Value for this object.
std::string Json() const override
Generate JSON string of this object.
void Close() override
Close File.
Exception for files that can not be found or opened.
Exception for invalid JSON.
openshot::ReaderInfo info
Information about the current media file.
virtual void SetJsonValue(const Json::Value root)=0
Load Json::Value into this object.
virtual Json::Value JsonValue() const =0
Generate Json::Value for this object.
Exception when a reader is closed, and a frame is requested.
This namespace is the default namespace for all code in the openshot library.
std::shared_ptr< QImage > Magick2QImage(std::shared_ptr< Magick::Image >)
Convert Magick::Image to QImage.
const Json::Value stringToJson(const std::string value)
bool has_single_image
Determines if this file only contains a single image.
float duration
Length of time (in seconds)
int width
The width of the video (in pixesl)
openshot::Fraction fps
Frames per second, as a fraction (i.e. 24/1 = 24 fps)
openshot::Fraction display_ratio
The ratio of width to height of the video stream (i.e. 640x480 has a ratio of 4/3)
int height
The height of the video (in pixels)
int64_t video_length
The number of frames in the video stream.
std::string vcodec
The name of the video codec used to encode / decode the video stream.
openshot::Fraction pixel_ratio
The pixel ratio of the video stream as a fraction (i.e. some pixels are not square)
bool has_video
Determines if this file has a video stream.
bool has_audio
Determines if this file has an audio stream.
openshot::Fraction video_timebase
The video timebase determines how long each frame stays on the screen.
int64_t file_size
Size of file (in bytes)