Solved

Convert TIFF to JPEG Extension Issue

Posted on 2010-11-16
5
637 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

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Compile Error 7 41
problems with mysql ODBC Connector and vbscript 4 28
TSQL previous 5 24
Ssis not sending failure message 2 10
Not long ago I saw a question in the VB Script forum that I thought would not take much time. You can read that question (Question ID  (http://www.experts-exchange.com/Programming/Languages/Visual_Basic/VB_Script/Q_28455246.html)28455246) Here (http…
In this article I will describe the Copy Database Wizard method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Internet Business Fax to Email Made Easy - With  eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, f…

920 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

17 Experts available now in Live!

Get 1:1 Help Now