Solved

Convert TIFF to JPEG Extension Issue

Posted on 2010-11-16
5
634 Views
Last Modified: 2012-05-10
I'm trying to use a SSIS 2008 package to go to a file share folder, retrieve all the files which will be in the Tiff format, and save them to another location (on the same server) so web users can have web access to them.  The catch is these pictures need to be saved as a gif or jpeg (what are some thoughts on .png?).

 I have the below code that is in a SSIS script task.  The SSIS package works, with no errors; however, it saves the tiff files as a Tiff file.  If i use an .aspx environment (I find this easier to test), the files are transfered to the correct folder, however, they don't have an extension (no .jpeg, .tiff, etc.)

 I developed this code on my computer and it works flawlessly, however, once I put it on the production server, this issue started to show up.  The production server doesn't recognize the jpeg or gif format, could this have something to do with it?

 Imports System
Imports System.Data
Imports System.Math
Imports System.Drawing
Imports System.IO
Imports System.Drawing.Imaging.ImageFormat
Imports Microsoft.SqlServer.Dts.Runtime


Public Sub Main()
        Dim StoreFile As Directory
        Dim Directory As String
        Dim Files As String()
        Dim File As String
        Dim bm As Bitmap

        'Asign Save as Location
        Directory = "C:\xx\xx\website\Folder\ChartImages\"

        'Asign the files to variable
        Files = StoreFile.GetFiles("X:\x")

        'Loops through the files
        For Each File In Files
            bm = Bitmap.FromFile(File)
            bm.Save(Directory & System.IO.Path.GetFileName(File) & "", Jpeg)
        Next
End Sub
0
Comment
Question by:badrhino
  • 3
  • 2
5 Comments
 
LVL 32

Accepted Solution

by:
Erick37 earned 500 total points
ID: 34147581
GIF and PNG formats are better for line art or graphic design where the image has large areas of solid colors.

Jpeg is best for photographs and pictures with fine detail.

PNG may be the best option for you if the encoders are installed.
0
 
LVL 1

Author Comment

by:badrhino
ID: 34147616
Thanks for the response and the advice on the file format!

How do I know if the encoder is installed, and if it isn't, how do I do this?

Thanks!
0
 
LVL 32

Assisted Solution

by:Erick37
Erick37 earned 500 total points
ID: 34147849
When you save the file, it does not look like you are changing the file extension from .tiff to .jpeg.

shouldn't this
bm.Save(Directory & System.IO.Path.GetFileName(File) & "", Jpeg)

be this?
bm.Save(Directory & System.IO.Path.GetFileName(File) & ".JPG", Jpeg)
0
 
LVL 1

Author Comment

by:badrhino
ID: 34147954
Not sure how I missed that, but your correct.  I changed it in my code and it works great.  
Thanks!
0
 
LVL 1

Author Comment

by:badrhino
ID: 34147963
Perhpas I should learn how to type....

Not sure how I missed that, but you're correct.  I changed it in my code and it works great.  
Thanks!
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

If you have heard of RFC822 date formats, they can be quite a challenge in SQL Server. RFC822 is an Internet standard format for email message headers, including all dates within those headers. The RFC822 protocols are available in detail at:   ht…
How to leverage one TLS certificate to encrypt Microsoft SQL traffic and Remote Desktop Services, versus creating multiple tickets for the same server.
This video discusses moving either the default database or any database to a new volume.
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now