1

So here's an overview of my program. You select a folder, containing images. The program imports all images in said folder (with the .JPG extension). Then, it exports these images into an MP4. For this program, I don't need a visible timeline, just a way to export said images.

I'd like to be able to set a universal duration and I want to (if possible) have a Ken Burns effect on each image, where the image simply is scaled up by like a factor of 5%-10% (this part doesn't have to change each time). As of right now, this is my code:

private void btnOpen_Click(object sender, EventArgs e)
{
    openFolder.Description = "Open a folder containing pictures for the slideshow!";

    if (openFolder.ShowDialog() == DialogResult.OK)
    {
        var folderPath = openFolder.SelectedPath;
        MessageBox.Show(folderPath);

        var fileArray = Directory.GetFiles(folderPath, "*.JPG");
        float duration = 4;
        float startpos = 0;
        foreach (var file in fileArray)
        {
            var filePath = $@"{folderPath}\{file}";
            MessageBox.Show(filePath);
            //add image to "timeline"
            startpos += 4;
        }
    }
    else
    {
        MessageBox.Show("Next time, select a folder and click open!", "Selection Cancelled", MessageBoxButtons.OK, MessageBoxIcon.Error);
    }
}

private void btnExport_Click(object sender, EventArgs e)
{
    if (presetList.SelectedIndex == -1)
        MessageBox.Show("Please select a preset!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
    else
    {
        if (presetList.SelectedItem.ToString() == "720p, 30fps")
        {
            //export code here
        }
        else if (presetList.SelectedItem.ToString() == "720p, 60fps")
        {
            //export code here
        }
        else if (presetList.SelectedItem.ToString() == "1080p, 30fps")
        {
            //export code here
        }
        else if (presetList.SelectedItem.ToString() == "1080p, 60fps")
        {
            //export code here
        }
    }
}

I've looked at a few libraries so far, but none of them seem to fit my needs, and all of them seem to be ridiculously expensive.

kogoia
  • 1,853
  • 3
  • 14
  • 33

1 Answers1

0

I have used Magick.net for similar tasks and it's a great open source library for these things. I know that they offer a feature to scale images.

Thomas V
  • 151
  • 13
  • How would I go about adding Magick.NET as a support (forgive me, I don't know the term) for my main program? And as far as I can see, Magick.NET doesn't support slideshows (or zoom in for each pic)... – theworldisonfireandimlaughing Jul 04 '17 at 23:11
  • 1
    @theworldisonfireandimlaughing you should look at the link Dan_Rayson posted as a comment. Hauns_TM posted a better solution at this question with better explanation and images. – Thomas V Jul 05 '17 at 09:50
  • Also Magick.net is available as nuget package for your program, you can add them as reference to your program. – Thomas V Jul 05 '17 at 09:54